
Paul,
There's nothing better than making a data type an instance of Num. In particular, fromInteger is a joy. But how about lists?
Do you mean something like Blargh below, only useful? John dorsey@elwood:~/src/scratch$ cat list.hs class Blargh f where fromList :: [a] -> f a data Foo a = Foo [a] deriving (Show) data Bar a = Bar [a] deriving (Show) instance Blargh Foo where fromList = Foo instance Blargh Bar where fromList l = Bar (reverse l) dorsey@elwood:~/src/scratch$ ghci list.hs GHCi, version 6.8.3: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. [1 of 1] Compiling Main ( list.hs, interpreted ) Ok, modules loaded: Main. *Main> fromList [1,2,3] :: Foo Int Foo [1,2,3] *Main> fromList [1,2,3] :: Bar Int Bar [3,2,1] *Main>