{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}

module Data.Binary.SerializationLength.TH
  ( hasFixedSerializationLength
  ) where

import Language.Haskell.TH

import Data.Binary.SerializationLength.Class


hasFixedSerializationLength :: Name -> Integer -> DecsQ
hasFixedSerializationLength (return . ConT -> t) (return . LitT . NumTyLit -> i) =
  [d|
    instance HasFixedSerializationLength $(t) where
      type SerializationLength $(t) = $(i)
  |]