Name: Ponster Menis !Ep8pui8Vw2 2007-03-17 10:59 ID:cyRS7xdF
Allow me to translate these function definitions into what they really are!
Yes, functions are arrows, that's why this works!
Knowing this is really good when you are doing random numbers:
Look up the specifications and you'll see that random (in the class Random) should take a RandomGen and return (x, g) where x is the random value and g is the generator. next returns a similar pair with an int and the new generator that should be returned.
It's magic I'm telling you!
(>>>) :: a b c -> a c d -> a b d
(>>>) :: (b -> c) -> (c -> d) -> (b -> d)
first :: a b c -> a (b, d) (c, d)
first :: (b -> c) -> ((b, d) -> (c, d))Yes, functions are arrows, that's why this works!
Knowing this is really good when you are doing random numbers:
random = first (\ n -> ...) . nextLook up the specifications and you'll see that random (in the class Random) should take a RandomGen and return (x, g) where x is the random value and g is the generator. next returns a similar pair with an int and the new generator that should be returned.
It's magic I'm telling you!