13 Oct 20:48
Very silly
From: Andrew Coppin <andrewcoppin <at> btinternet.com>
Subject: Very silly
Newsgroups: gmane.comp.lang.haskell.cafe
Date: 2008-10-13 18:51:43 GMT
Subject: Very silly
Newsgroups: gmane.comp.lang.haskell.cafe
Date: 2008-10-13 18:51:43 GMT
{-# LANGUAGE FlexibleInstances #-}
module Overload where
class Silly s where
go :: s
instance Silly ([x] -> [x]) where
go = reverse
instance Silly (Int -> Int) where
go = (+1)
Don't even ask.
Suffice it to say, you *can* make Haskell support arbitrary overloading
of function names like C++ has, _if_ you abuse the type system violently
enough. Please, won't somebody think of the children?!?
RSS Feed