Copyright | (c) Yusuke Matsushita 2014 |
---|---|
License | BSD3 |
Maintainer | Yusuke Matsushita |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Template haskell tools for clusses.
Basic tools are in the module Type.Cluss.
Documentation
clussify :: Name -> Q Type Source
clussify
converts a type class into a cluss, roughly speaking.
For example, if the visible instances of Show
were to be only
, Show
Int
, and Show
a => Show
[a](
,
the result of Show
a, Show
b) => Show
(a, b)$(
will be
clussify
''Show
)
Show >|< In [Type Int, Unary [] Show, Binary (,) (Show >|< Show)]
(in fact, the result will be more verbose, using
instead of Show
>|< Pure
>++< Pure
>|< Show
).
Show
>|< Show
Due to the stage restriction of template haskell, clussify
can't catch the instances defined in the module where the classify
is written.
Note that clussify
neglects complicated instances that cannot be simply expressed with the combinators in the module Type.Cluss.
You need some language extensions to use clussify
. Basically, this language pragma will do.
{-# LANGUAGE TemplateHaskell, ConstraintKinds #-}