Question: What would you use in Elm?

Asked By
reactormonk
Asked At
2018-01-26 21:29:32

Found 15 possible answers.

User Answered At Possible Answer
puremonad 2018-01-26 21:31:48 andThen? :slightly_smiling_face:
reactormonk 2018-01-26 21:35:39 That's called >>= in Haskell, it's infix If you wanna use it as prefix, go with (>>=)
folkertdev 2018-01-26 22:12:54 wouldn't you use map ?
String -> IO String
so `combined filename = fmap splitByLines (fileGetContents filename` wich has type `String -> IO [String]`
Haskell has a general map fmap :: (a -> b) -> f a -> f b String -> [String]
reactormonk 2018-01-26 22:18:33 Yeah you would.
puremonad 2018-01-26 22:21:03 wow thank :wink: but maybe someone can explain how can i solve it using >>= ?
reactormonk 2018-01-26 22:35:03 @puremonad what's your learning resource?
puremonad 2018-01-26 22:37:08 google
reactormonk 2018-01-27 00:05:36 Get a more structured one.
apooooop 2018-01-27 00:31:18 to start to answer your question, @puremonad , start by looking at the types of fmap and (>>=) :
(>>=) :: m a -> (a -> m b) -> m b
and (I assume), you want to get something of type `x -> y [x]`
you’ve presented something (vaguely) of type `x -> y x`, and something else of type `x -> [x]`
now, compare the types of the functions that you have, and think about what you’re trying to do fmap :: (a -> b) -> f a -> f b
puremonad 2018-01-29 07:23:50 Thanks @apooooop
pdavidow 2018-01-30 01:50:34 Could the Yesod Haskell web-framework be morphed into using the approach of Elm's style-elements'? In the Haskell ghci repl, I'm having trouble with record syntax. I would have expected let point = {x = 3, y = 4} to work, but it gives me parse error on input {'
mstruebing 2018-02-04 06:11:50 Hey, I wanted to start web-dev with haskell, is yesod a recommended framework or are there others, more promising solutions?
damncabbage 2018-02-04 07:12:47 Yesod's a good way to get going with something that'll give you all the pieces. When you're more comfortable, https://github.com/qfpl/applied-fp-course would be a good thing to go back to to learn how apps and frameworks can be built from scratch; I wouldn't do a bunch of what it's doing, but it's a good exercise to learn how the plumbing works. Later alternatives (that you might of heard of), after you've gotten more comfortable, are Servant (advanced; I stay away from it) and working with Wai (Haskell's version of Rack, Plug, WSGI, etc) directly with some helper functions. Scotty is like a quick-start bare-bones thing like Sinatra (Ruby) or Flask (Python), but you quickly run into things like "so how do i do auth".
mstruebing 2018-02-04 07:22:58 thanks, the course seems very intersting
damncabbage 2018-02-04 08:10:32 It's definitely something you want to do *after* you've gotten past completely-newbie haskell; it's trying to add stairs *after* the "hello world and/or functors and monads"-level tutorials and courses you do.

Related Questions