perhaps

Udo Stenzel u.stenzel at web.de
Mon Aug 14 08:22:55 EDT 2006


Bulat Ziganshin wrote:
> type classes is universal answer to almost any question ;)

Argh!  Every complex problem has a simple and wrong answer, huh?  At
some point you should stop generalizing, because doing everything
equally bad is the same as doing nothing right (but requires more work).

 
> data B = F | T deriving Boolean

Now is 

    toBool :: Silliness -> Bool

equivalent to isSilly or to isSensible?  See, the gain in readability
is... uhm... questionable.


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

btw,

fromBool :: Enum b => Bool -> b
fromBool = fromEnum.toEnum

toBool :: Enum b => b -> Bool
toBool = fromEnum.toEnum

is a lot simpler and exactly as useful (read: not at all).

 
Udo.

PS: No, I don't think 'perhaps' is all that useful.  It lacks obvious
    semantics and is easily defined should you need it, in which case
    you also know how it should behave.
-- 
I loathe people who keep dogs.  They are cowards who haven't got the
guts to bite people themselves.
	-- August Strindberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/libraries/attachments/20060814/14225ceb/attachment.bin


More information about the Libraries mailing list