[Haskell-cafe] [ANN] anonymous-sums

Omari Norman omari at smileystation.com
Sat Feb 15 17:32:58 UTC 2014


On Sat, Feb 15, 2014 at 9:08 AM, Roman Cheplyaka <roma at ro-che.info> wrote:
>> partitionS0 :: [S0] -> ()
>>
>> I suppose that makes sense if you look at partition as returning the
>> same number of lists as there are type variables.  No type variables,
>> no lists.  Or should it be
>>
>> partitionS0 :: [S0] -> Void
>>
>> which also makes me wonder if this is a special case better left to Data.Void.
>
> The result should be a 0-tuple, i.e. (), of course.
>
> Otherwise, what would paritionS0 [] return?

OK, so with EmptyDataDecls this yields:

data S0 deriving (Generic, Typeable)

instance Eq S0 where _ == _ = undefined
instance Ord S0 where compare _ _ = undefined
instance Read S0 where readsPrec _ = undefined
instance Show S0 where show _ = undefined

partitionS0 :: [S0] -> ()
partitionS0 _ = ()

caseS0 :: S0 -> z
caseS0 = undefined

mapS0 :: S0 -> S0
mapS0 = id

mapS0f :: Functor ftr => S0 -> ftr S0
mapS0f = undefined


More information about the Haskell-Cafe mailing list