Copyright | (C) 2014 Richard Eisenberg |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Richard Eisenberg (eir@cis.upenn.edu) |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Expands type synonyms and type families in desugared types. See also the package th-expand-syns for doing this to non-desugared types.
Expand synonyms soundly
expandType :: DsMonad q => DType -> q DType Source #
Expands all type synonyms in a desugared type. Also expands open type family applications, as long as the arguments have no free variables. Attempts to expand closed type family applications, but aborts the moment it spots anything strange, like a nested type family application or type variable.
Expand synonyms potentially unsoundly
expandUnsoundly :: (DsMonad q, Data a) => a -> q a Source #
Expand all type synonyms and type families in the desugared abstract syntax tree provided, where type family simplification is on a "better than best effort" basis. This means that it will try so hard that it will sometimes do the wrong thing. Specifically, any kind parameters to type families are ignored. So, if we have
type family F (x :: k) where F (a :: *) = Int
expandUnsoundly
will expand F 'True
to Int
, ignoring that the
expansion should only work for type of kind *
.
This function is useful because plain old expand
will simply fail
to expand type families that make use of kinds. Sometimes, the kinds
are benign and we want to expand anyway. Use this function in that case.