Following a suggestion from Cale Gibbard I added a convenient feature to Djinn.
You can now define type classes and have contexts on functions.
As with Djinn in general there is no polymorphic instantiation, so the methods of a class must not mention any type variables, but the class parameters. This makes the whole thing rather limited, but it was a quick hack.
Sample session

Welcome to Djinn version 2007-04-20. Type :h to get help. Djinn> f ? (Eq a) => a -> a -> (b,c) -> Either b c f :: (Eq a) => a -> a -> (b, c) -> Either b c f a b = case a == b of False -> \ (c, _) -> Left c True -> \ (_, d) -> Right dThe Djinn source is at darcs.augustsson.net/Darcs/Djinn as usual. Thanks Cale!

Labels: Haskell

## 0 Comments:

Post a Comment

<< Home