[Haskell-cafe] How to do this with associated types?

Christopher Lane Hinson lane at downstairspeople.org
Sun Jul 25 17:41:17 EDT 2010



> But what to do with Maybe?
>
>> instance Result Maybe where
>>   type Failure Maybe = forall e. e -- can't do this
>>   failure _ = Nothing
>>   success x = Just x

Normally, I would use: type Failure Maybe = ()

Unless the ability to discard information of any type is somehow a salient feature.

Friendly,
--L



More information about the Haskell-Cafe mailing list