fork download
  1. {-# LANGUAGE FlexibleInstances, OverlappingInstances #-}
  2.  
  3. class IsFunction a where
  4. isFunction :: a -> Bool
  5.  
  6. instance IsFunction (a -> b) where
  7. isFunction _ = True
  8.  
  9. instance IsFunction a where
  10. isFunction _ = False
  11.  
  12. main = print (isFunction (+)) >> print (isFunction "0")
Success #stdin #stdout 0s 6260KB
stdin
Standard input is empty
stdout
True
False