-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Deriver for Data.Vector.Unboxed using Template Haskell
--   
--   A Template Haskell deriver for unboxed vectors, given a pair of
--   coercion functions to and from some existing type with an Unbox
--   instance.
--   
--   Refer to <a>Data.Vector.Unboxed.Deriving</a> for documentation and
--   examples.
@package vector-th-unbox
@version 0.2.1.6


module Data.Vector.Unboxed.Deriving

-- | Let's consider a more complex example: suppose we want an
--   <tt>Unbox</tt> instance for <tt>Maybe a</tt>. We could encode this
--   using the pair <tt>(Bool, a)</tt>, with the boolean indicating whether
--   we have <tt>Nothing</tt> or <tt>Just</tt> something. This encoding
--   requires a dummy value in the <tt>Nothing</tt> case, necessitating an
--   additional <a>Default</a> constraint. Thus:
--   
--   <pre>
--   derivingUnbox "Maybe"
--       [t| ∀ a. (Default a, Unbox a) ⇒ Maybe a → (Bool, a) |]
--       [| maybe (False, def) (\ x → (True, x)) |]
--       [| \ (b, x) → if b then Just x else Nothing |]
--   </pre>
derivingUnbox :: String -> TypeQ -> ExpQ -> ExpQ -> DecsQ
