[Haskell-cafe] pure programs

Conal Elliott conal at conal.net
Wed Nov 5 20:01:42 EST 2008


Hi Jason,

To help me understand your question, would you be unhappy with the following
structure?

    -- runnable
    main = interact f
    -- composable
    f = ...

The discipline is to use interact (or another combinator) to wrap a
functional/composable/pure component like f into an executable.  Then give
main to users and f to programmers.  This same game can be made more
sophisticated, eg

    main = interact (show . f . read)

Or unparse & parse in place of show & read.

For more on combining usability and composability, see

    http://haskell.org/haskellwiki/TV

http://conal.net/blog/posts/tangible-functional-programming-a-modern-marriage-of-usability-and-composability/

    - Conal

On Tue, Nov 4, 2008 at 4:12 PM, Jason Dusek <jason.dusek at gmail.com> wrote:

>  Informally, a "pure program" an executable such that the
>  stream of bytes entering it totally determines the stream of
>  bytes leaving it.
>
>  Many useful programs that I would like to write in Haskell
>  don't fall into this category -- for example, network servers
>  -- but a lot of their components do. Can these components can
>  be Haskell functions without IO in their signatures?
>
>  Though that seems reasonable, it is not, in general, true. For
>  example,    System.Info.os    is generally treated as pure,
>  though it is not. It's not clear to me how to disambiguate
>  these "born again" values from really pure values.
>
> --
> _jsn
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081105/5aec6dd3/attachment.htm


More information about the Haskell-Cafe mailing list