8 Feb
2002
8 Feb
'02
11:56 a.m.
On Fri, Feb 08, 2002 at 12:39:30PM +0100, Rijk J.C.van Haaften wrote:
Ashley Yakeley wrote:
I'd like to be able to declare the kinds of new types and synonyms, because sometimes Haskell can't infer them.
It is possible using a trick due to John Hughes. In Proceedings of the 1999 Haskell Workshop, he wrote in his article Restricted Data Types in Haskell [...]
data Set cxt a = Set [a] | Unused (cxt a -> ()) deriving Show
Another kludge, that works with newtypes too, is type Hint a b = a newtype Set cxt a = Set (Hint [a] (cxt a)) deriving Show