-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | emulate partial type signatures with template haskell -- -- emulate partial type signatures with template haskell @package PartialTypeSignatures @version 0.1.0.0 -- | Example usage (GHC-7.8): -- --
-- sigs -- [| ["f1" :: a -> b -> (a, Int), -- "f1" :: b -> a -> (Char, a) ] |] -- -- f1 x y | False = $(unionSigs [| f1 x y |]) -- f1 x y = undefined -- (x,y) ---- -- A GHC-7.6 compatible version must be slightly longer to work around -- the extra typechecking done of [| |] brackets: -- --
-- sigs [| do -- f2 <- Nothing -- Just [ f2 :: a -> b -> (a, Int), -- f2 :: b -> a -> (Char, a) ] -- |] -- -- f2 x y | False = $(unionSigs [| f2 x y |]) -- f2 x y = undefined -- (x,y) ---- -- If the expression splice generated by unionSigs is left out, -- --
-- sigs -- [| ["g" :: a -> b -> (a, Int), -- "g" :: b -> a -> (Char, a) ] |] -- -- g x y = undefined -- (x,y) ---- -- then g's type takes the most general type (g :: t), -- and the two functions defined by sigs can be used to restrict -- the type of g: -- --
-- partialTypeSig_g1 :: (t -> t1 -> (t, Int)) -> t -> t1 -> (t, Int) -- partialTypeSig_g1 = id -- -- partialTypeSig_g2 :: (t -> t1 -> (Char, t1)) -> t -> t1 -> (Char, t1) -- partialTypeSig_g2 = id --module PartialTypeSigs sigs :: ExpQ -> DecsQ unionSigs :: ExpQ -> ExpQ