[Haskell-cafe] Composing a list of Enumeratees into an Enumerator using ($=)

Román González romanandreg at gmail.com
Tue Oct 4 03:00:15 CEST 2011


Hey guys,

Right now I'm facing with a type problem that is really nasty, I want to
compose a list of enumeratees using the ($=) operator to create a new
enumerator.  Whenever I'm trying to use the foldx function in conjunction
with ($=) I get this error:

*> :t foldr ($=)*

<interactive>:1:7:
    Occurs check: cannot construct the infinite type:
      b0 = Step ao0 m0 b0
    Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
                   -> Enumeratee ao0 ao0 m0 b0
                   -> Enumeratee ao0 ao0 m0 b0
      Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
                   -> Enumeratee ao0 ao0 m0 b0
                   -> Enumerator ao0 m0 b0
    In the first argument of `foldr', namely `($=)'
    In the expression: foldr ($=)

*> :t Prelude.foldl ($=)*

<interactive>:1:15:
    Occurs check: cannot construct the infinite type:
      b0 = Step ao0 m0 b0
    Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
                   -> Enumeratee ao0 ao0 m0 b0
                   -> Enumerator ao0 m0 (Step ao0 m0 b0)
      Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
                   -> Enumeratee ao0 ao0 m0 b0
                   -> Enumerator ao0 m0 b0
    In the first argument of `Prelude.foldl', namely `($=)'
    In the expression: Prelude.foldl ($=)

<interactive>:1:15:
    Occurs check: cannot construct the infinite type:
      b0 = Step ao0 m0 b0
    Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
                   -> Enumeratee ao0 ao0 m0 b0
                   -> Enumerator ao0 m0 (Step ao0 m0 b0)
      Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
                   -> Enumeratee ao0 ao0 m0 b0
                   -> Enumerator ao0 m0 b0
    In the first argument of `Prelude.foldl', namely `($=)'
    In the expression: Prelude.foldl ($=)

Obviously there is something I don't quite understand about the ($=) (=$)
functions, how can one compose a list of enumeratees, is it even possible?

Cheers.

Roman.-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111003/643942ba/attachment.htm>


More information about the Haskell-Cafe mailing list