derive-2.6.4: A program and library to derive instances for data types

Safe HaskellNone
LanguageHaskell2010

Data.Derive.UniplateDirect

Description

Derive Uniplate and Biplate using the Direct combinators. You must request monomorphic instances, i.e:

data Foo a = Foo a (Bool, a)

{-!
deriving instance UniplateDirect (Foo Int)
deriving instance UniplateDirect (Bool, Int) Int
deriving instance UniplateDirect (Foo Int) Int
!-}

This will generate the instances Uniplate (Foo Int), Biplate (Bool, Int) Int and Biplate (Foo Int) Int. Generally, start with the instance you are after (e.g. UniplateDirect (Foo Int)), try to compile and add further instances as necessary. UniplateDirect with one argument derives Uniplate, and with two arguments derives Biplate.

deriving UniplateDirect on a data type with no arguments derives Uniplate with all type parameters defaulting to ().

Documentation