Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell tip of the day!

Name: Anonymous 2007-11-20 20:55

Did you know that types are curried?
Prelude> :kind Either
Either :: * -> * -> *
Prelude> :kind Either Bool
Either Bool :: * -> *

Let's try it out!
type ThrowsError = Either String
safeDivide :: (Fractional a) => a -> a -> ThrowsError a
_ `safeDivide` 0 = Left "cannot divide by zero"
(safeDivide) = Right `dot` (/) where dot = (.) . (.)


-- Your friendly Haskell tipster :).

Name: Anonymous 2007-11-21 7:03

>>10
How old are, eight?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List