[Haskell-cafe] message passing style like in Haskell?

jinjing nfjinjing at gmail.com
Wed Jun 18 23:33:56 EDT 2008

Hi guys,

This is my second attempt to learn Haskell :)

Any way here's the code:

module Dot where
import Prelude hiding ( (.) )

(.) :: a -> (a -> b) -> b
a . f = f a

infixl 9 .

So for example, 99 questions: Problem 10
(*) Run-length encoding of a list.


encode xs = map (\x -> (length x,head x)) (group xs)


encode xs = xs.group.map token where token x = (x.length, x.head)

I found starting with data and working my way to a solution seems to be
easier to think with, or maybe it's just me ...

What is your thought?


More information about the Haskell-Cafe mailing list