Lucu-1.0: Embedded HTTP Server

Data.Collections.Newtype.TH

Description

Doesn't anyone know why these instances can't be derived using GeneralizedNewtypeDeriving? I think its limitation isn't reasonable at all...

Synopsis

Documentation

derive :: Q [Dec] -> Q [Dec]Source

Automatic newtype instance deriver for type classes defined by the collections-api package.

   {-# LANGUAGE TemplateHaskell #-}
   module Foo (T) where
   import Data.Collections
   import Data.Collections.BaseInstances ()
   import qualified Data.Collections.Newtype.TH as C
   import qualified Data.Map as M

newtype T = T (M.Map Int Bool)

C.derive [d| instance Unfoldable T (Int, Bool)
                instance Foldable   T (Int, Bool)
                instance Indexed    T  Int  Bool
                ...
              |]

This function can derive the following instances:

  • Unfoldable
  • Foldable
  • Collection
  • Indexed
  • Map
  • Set
  • SortingCollection