On Tue, Apr 9, 2013 at 6:34 PM, Ovidiu D <ovidiudeac@gmail.com> wrote:
I would expect the following to work as well:
main =
    Conduit.sourceList [1..14]
    $= Conduit.map show
    $= display
    $$ Conduit.sinkNull

display = Conduit.iterM putStrLn $= Conduit.iterM putStrLn

...but I get the compilation error:
Couldn't match expected type `String' with actual type `()'
    Expected type: Conduit.Conduit String m0 a0
      Actual type: Conduit.Source IO ()
    In the second argument of `($=)', namely `display'
    In the first argument of `($$)', namely
      `Conduit.sourceList [1 .. 14] $= Conduit.map show $= display'

This looks to me like the monomorphism restriction kicked in and extended defaulting is turned on, so () got inferred? If so, {-# LANGUAGE NoMonomorphismRestriction #-} at the top of the file should help.

(If this is actually in ghci, then that is almost certainly what happened; many people shut off the monomorphism restriction in ghci to avoid this annoyance.)

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net