perhaps

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Aug 14 03:52:03 EDT 2006


Hello kahl,

Monday, August 14, 2006, 8:15:05 AM, you wrote:

> Unfortunately the relevant prelude functions, like not, &&, all, ...,
> are all written in a way that they don't work for Silliness.

type classes is universal answer to almost any question ;)

data B = F | T deriving Boolean

and :: (Boolean t, Foldable c) => c t -> t

or, in the fashion i just described in cafe:

and :: Foldable Boolean -> Boolean



btw,

class Enum a => Boolean a where
  fromBool :: Bool -> a
  toBool   :: a -> Bool
  fromBool = fromEnum.toEnum
  toBool   = fromEnum.toEnum

  
so the only change required in Haskell compilers to make possible
implementing this idea is to make:

data T = ... deriving C

equivalent to

instance C T

for classes whose automatic deriving is not supported by the Haskell itself
  

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Libraries mailing list