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

Conrad Parker conrad at metadecks.org
Tue Oct 4 03:52:08 CEST 2011


2011/10/4 Román González <romanandreg at gmail.com>:
> 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?

Hi,

what are you trying to actually do, ie. what kind of data are you
trying to transform, what are the inputs and outputs of each
enumeratee?

are you trying to feed the output of the first enumeratee into the
input of the second, and so on? or are you trying to run them all in
parallel?

Conrad.



More information about the Haskell-Cafe mailing list