Git Product home page Git Product logo

elm-console's People

Contributors

avh4 avatar blacktaxi avatar deadfoxygrandpa avatar greyepoxy avatar jvoigtlaender avatar laszlopandy avatar maxsnew avatar process-bot avatar xdissent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

elm-console's Issues

causes error in browser when running elm-test when elm test code is compiled with webpack

Full details are here deadfoxygrandpa/elm-test#32 (comment)

Essentially what is going on is that I am seeing

require is not defined


Open the developer console for more details.

Appears to be happening because when compiling my test code with webpack via the elm-webpack-loader. module.exports = Elm; is appended to the resulting file making the current guards around the require call insufficient.

Fix seems to be to just add a check to see if require is defined. Will send out a pull request.

Add readFile

It would be nice to read from a file. readFile : String -> IO String. An invalid path would be the same as pure ""; alternatively it may return an IO (Maybe String) or similarly with a Result.

If you like the idea but don't have time to implement it, I could sent a PR sometime next week.

Upgrade for Elm 0.17

I wish I could send you a PR for upgrading from 0.16, but now that Signal is gone I'm not sure how to do it....

Writing the result of a Task to the Console

First of all, thanks for picking this up for Elm 0.16!

I was trying to use elm-console in a context where I have a Task that produces a String, and I want to write this string to the console. Here's some code to illustrate:

task : Task () String
task =
    Task.succeed "String"

io : Task () (IO ())
io =
    Task.map Console.putStrLn task

port runner : Task () (Signal (Task x ()))
port runner =
    Task.map Console.run io

Now, in this case the Task is obviously trivial, but imagine code where there really was an substantial Task involved that ultimately could be mapped to a String.

The code above will compile, but it doesn't really make any sense (and doesn't work), because a Task which results in a signal of tasks isn't really sensible within Elm, for a variety of reasons. So, it's a dead end.

So, I was trying to conceive of what is missing here. One way of thinking about it would be that we need a function of this form:

fromTask : Task x a -> IO (x, a)

Now, one complication for implementation would be arranging for the task to be executed when the IO is executed, but that doesn't seem impossible.

If one had this "bridge" between Task-world and IO-world, I think it would cover a lot of cases.

Some others one could imagine are:

onSuccess : Task x (IO a) -> IO a

onError : Task (IO x) a -> IO x

So, I'm wondering whether I'm thinking about this the right way -- is there a better way to imagine how this might work?

In passing, I think there are similar puzzles re: Signals and IO ... for instance, what if you had a Signal String and you wanted to write each String to the console as it arrived? I'm not sure how you'd do that either, but I haven't thought much about it.

0.17 support?

Hello!
Love your work!
Im here asking if there will be a port over to elm 0.17?

Run signal of IOs

Hello,

So, I'm using elm-console to run elm-test tests. But I have the case where I'm trying to test signals and effects.

Long story short, I manage to end up with a Signal Test, and I need to map those tests to consoleRunner then Console.run to run the tests each time a new test comes from the signal.

But Console.run takes an IO and returns a Signal of Tasks, so I would end up with Signal (Signal (Task.Task x ())), and Signal of Signals aren't allowed in elm.

My workaround to solve this was creating this library: signal-concat-map that allows me to concatMap signals, by using native modules.

You can check out the final code of the TestRunner here.

I wouldn't need this if there was a way to run signals of IO, like this:

Console.runSignal : Signal IO -> Signal (Task x ())

Is this possible in elm-console?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.