Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRandom functor monad #51
Conversation
imeckler
added some commits
Dec 14, 2014
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
kasbah
Feb 21, 2015
Contributor
+1 to merge this, I was looking for these and had started to write them myself.
|
+1 to merge this, I was looking for these and had started to write them myself. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
kasbah
Feb 21, 2015
Contributor
Though I found your shadowing of generate a bit confusing. I had written this map:
map : (a -> b) -> Generator a -> Generator b
map f (Generator g) = Generator <| (\(v,seed) -> (f v, seed)) << g
and I changed your andThen to
andThen : Generator a -> (a -> Generator b) -> Generator b
andThen (Generator g) f = Generator <| \seed ->
let (v,seed') = g seed
(Generator h) = f v
in h seed'
for my own use.
|
Though I found your shadowing of
and I changed your
for my own use. |
evancz
merged commit 9027458
into
elm:master
Jun 30, 2015
1 check failed
continuous-integration/travis-ci
The Travis CI build could not complete due to an error
Details
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Thanks @imeckler, I think this will come in handy! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
imeckler commentedDec 14, 2014
I added functions
and
to the
Randommodule. Is there another name you prefer toandThen? I was shooting for consistency with theMaybemodule. Also, does anyone have any ideas about a uniform convention for Applicative "instances"? CurrentlyRandomexportspair : Generator a -> Generator b -> Generator (a, b), but as far as I can tell no other module exports a function of the same name.