[Haskell-beginners] print []

Brandon Allbery allbery.b at gmail.com
Tue Aug 13 16:59:09 CEST 2013


On Tue, Aug 13, 2013 at 10:46 AM, Lukas Lehner <lehner.lukas at gmail.com>wrote:

> That means ghc cannot infer the type.
> Is there a way how to # print flatten (List []) ?
> Or even more general, print [] without enforcing the type?
>

If you turn on the ExtendedDefaultRules extension ( `{-# LANGUAGE
ExtendedDefaultRules #-}` pragma or `-X ExtendedDefaultRules` ghc option),
ghc will infer () for the type just as ghci does. Note that this reduces
type safety a bit, since ghc will now accept programs that have what
otherwise would be type errors.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130813/49c4140c/attachment.htm>


More information about the Beginners mailing list