[Haskell-cafe] Parsec3 stream properties

Philippa Cowderoy flippa at flippac.org
Tue Feb 5 23:49:18 EST 2008


I'm having a little difficulty finding full properties for Parsec3's 
Stream class, largely because I don't want to overspecify it with regard 
to side-effects. Here's the class:

>  class Stream s m t | s -> t where
>    uncons :: s -> m (Maybe (t,s))

The idea is that: 

* unfoldM uncons gives the [t] corresponding to the stream

* Assuming no relevant side-effects, unconsing the same value twice will 
yield the same result

What's a relevant side-effect? Well, that's up to the stream and the monad 
it's built in - but unconsing once shouldn't affect the result of 
unconsing a second time unless you've found something fiendishly clever 
that I haven't thought of. Using stream mutability to implement a 
programming language from within the parsing monad is not a good idea, 
though no doubt someone'll do it anyway!

-- 
flippa at flippac.org

Society does not owe people jobs.
Society owes it to itself to find people jobs.


More information about the Haskell-Cafe mailing list