[Haskell-cafe] I hate Haskell's typeclasses

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Apr 21 14:21:21 EDT 2008


On Apr 21, 2008, at 3:50 , Ryan Ingram wrote:

>> is almost unnecessary; (btw., functions /are/ instances of Show).
>
> Now it's my turn to call:
>
> Prelude Test.QuickCheck> show ((\x -> x) :: Int -> Int)
> <interactive>:1:0:
>     No instance for (Show (Int -> Int))

import Data.Function.  (but it is indeed a useless instance)

A slightly less useless instance (more or less the one lambdabot  
uses) is at http://www.cmu.edu.edu/~allbery/FuncShow.hs; note that it  
only works for monomorphic functions (more specifically, for  
functions whose parameters are Typeable).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list