module Default (
Default(..)
) where
class Default alpha where
getDefault :: alpha
instance Default Int where
getDefault = 1
instance Default alpha => Default (Either alpha beta) where
getDefault = Left getDefault
instance (Default alpha, Default beta) => Default (alpha, beta) where
getDefault = (getDefault,getDefault)
instance (Default alpha, Default beta, Default gamma) => Default (alpha, beta, gamma) where
getDefault = (getDefault,getDefault,getDefault)
instance Default [alpha] where
getDefault = []
instance Default (Maybe alpha) where
getDefault = Nothing
instance Default Bool where
getDefault = True