24 karma · joined Oct 31, 2012 (14y ago) · 3 submissions
comment 14y ago · link · parent
comment 14y ago · link · parent
What I saw, was that the amount of tests could be reduced, when using haskell. The type of testing is also somewhat different. You don't have to test for type errors. QuickCheck let you test mathematical properties (in an empiric way).
The FFI compensates for the missing libraries, but is a bit difficult to use.
But the biggest reason of using haskell for me, was the way it handles concurrency and the high abstraction level. This enables you to write distributed applications in a more convenient way than usual. If you working in a web start up, you hit somewhere a point, where you need to think about this stuff.
Besides Yesod, Snap is also a interesting choice, because of it's simplicity.
I enjoy using this language. I would choose it anytime. It made me a better programmer.
comment 14y ago · link · parent
Say we have a failing computation: failComp = Nothing
and a couple of succeeding computations: sucComp = Just 1 sucComp2 = Just 2
We can use the typeclasses to avoid explicit unpacking:
-- Monad result: Just 3
add = do x <- sucComp2 y <- sucComp return $ x + y
Applicative result: Just 3
-- the <#> should be the applicative operator. addapp = (+) <$> sucComp <#> sucComp2
Alternative: result (Just 1)
val = failComp <|> sucComp
Monoid: result (Just 2)
mon = failComp <> sucComp2
Functor result (Just 6)
-- # should be multiply operator
func = fmap (#3) sucComp2