{-# LANGUAGE TemplateHaskell            #-}

module Data.API.Tools.SafeCopy
    ( safeCopyTool
    ) where

import           Data.API.Tools.Combinators
import           Data.API.Tools.Datatypes

import           Data.SafeCopy


-- | Tool to derive 'SafeCopy' instances for generated types.  At
-- present, this derives only base version instances.
safeCopyTool :: APITool
safeCopyTool :: APITool
safeCopyTool = Tool APINode -> APITool
apiDataTypeTool (Tool APINode -> APITool) -> Tool APINode -> APITool
forall a b. (a -> b) -> a -> b
$ (APINode -> Q [Dec]) -> Tool APINode
forall a. (a -> Q [Dec]) -> Tool a
simpleTool ((APINode -> Q [Dec]) -> Tool APINode)
-> (APINode -> Q [Dec]) -> Tool APINode
forall a b. (a -> b) -> a -> b
$ Version Any -> Name -> Name -> Q [Dec]
forall a. Version a -> Name -> Name -> Q [Dec]
deriveSafeCopy Version Any
0 'base (Name -> Q [Dec]) -> (APINode -> Name) -> APINode -> Q [Dec]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. APINode -> Name
rep_type_nm