[Haskell-cafe] Very silly

Andrew Coppin andrewcoppin at btinternet.com
Mon Oct 13 14:51:43 EDT 2008


{-# 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?!?



More information about the Haskell-Cafe mailing list