GADTs in the wild
Christian Maeder
Christian.Maeder at dfki.de
Tue Aug 14 17:52:06 CEST 2012
Am 14.08.2012 14:48, schrieb Felipe Almeida Lessa:
> data AccessToken kind where
> UserAccessToken :: UserId -> AccessTokenData -> UTCTime ->
> AccessToken UserKind
> AppAccessToken :: AccessTokenData -> AccessToken AppKind
>
> data UserKind
> data AppKind
>
> (Yes, that could be a data kind!) And for convenience we also export
> some type synonyms:
>
> type UserAccessToken = AccessToken UserKind
> type AppAccessToken = AccessToken AppKind
Why not use plain h98?
data UserAccessToken = UserAccessToken UserId AccessTokenData UTCTime
data AppAccessToken = AppAccessToken AccessTokenData
type AccessToken = Either UserAccessToken AppAccessToken
C.
More information about the Glasgow-haskell-users
mailing list