Hidden features of Haskell -
what lesser-known useful features of haskell programming language. (i understand language lesser-known, work me. explanations of simple things in haskell, defining fibonacci sequence 1 line of code, upvoted me.)
- try limit answers haskell core
- one feature per answer
- give example , short description of feature, not link documentation
- label feature using bold title first line
my brain exploded
if try compile code:
{-# language existentialquantification #-} data foo = forall a. foo ignorefoo f = 1 foo = f
you error message:
$ ghc foo.hs foo.hs:3:22: brain exploded. can't handle pattern bindings existentially-quantified constructors. instead, use case-expression, or do-notation, unpack constructor. in binding group foo in pattern binding: foo = f in definition of `ignorefoo': ignorefoo f = 1 foo = f
Comments
Post a Comment