[Haskell-cafe] Info about List with terminal element

Daniel Díaz diaz.carrete at gmail.com
Thu Nov 26 20:35:54 UTC 2015


The type

Cofree (Either t) e


is isomorphic to a non-empty version of 

List t e 


On Wednesday, November 25, 2015 at 8:00:40 PM UTC+1, Silvio Frischknecht 
wrote:
>
> Hello, 
>
> I'm interested in learning more about a list-like structure with a 
> terminal element. I.e. 
>
> data List t e = Cons e (List t e) | Null t 
>
> or maybe 
>
> data List t e = Cons e (List t e) | Null | Terminal t 
>
>
> An practical application could be lazy reading from a file 
> readFile :: String -> List Error String 
>
> Obviously there is a Functor instance. There is even a Monad instance. 
> However, it is not defined as obviously because it's not clear what the 
> terminal element should be. There is a straight forward fold like 
> structure. 
>
> My questions are. 
>
> Are there more interesting generalizations of List? 
> What rules do they follow? 
> How should the Monad work? Why? 
>
> I know this is related to the whole Iteratee discussion (I'm not 
> completely familiar with it). 
>
> Cheers 
>
> Silvio 
> _______________________________________________ 
> Haskell-Cafe mailing list 
> Haskel... at haskell.org <javascript:> 
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151126/98a1cda5/attachment.html>


More information about the Haskell-Cafe mailing list