aboutsummaryrefslogtreecommitdiff
path: root/hsm-core/Hsm/Core
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-core/Hsm/Core')
-rw-r--r--hsm-core/Hsm/Core/Serial.hs27
1 files changed, 11 insertions, 16 deletions
diff --git a/hsm-core/Hsm/Core/Serial.hs b/hsm-core/Hsm/Core/Serial.hs
index 0fc89e8..a0efca3 100644
--- a/hsm-core/Hsm/Core/Serial.hs
+++ b/hsm-core/Hsm/Core/Serial.hs
@@ -2,22 +2,21 @@
module Hsm.Core.Serial
( makeSerial
- )
-where
+ ) where
import GHC.Num (integerFromInt)
import Language.Haskell.TH
- ( Body (NormalB)
- , Clause (Clause)
- , Con (NormalC)
- , Dec (DataD, FunD, SigD)
- , DerivClause (DerivClause)
- , Exp (LitE)
- , Lit (IntegerL)
+ ( Body(NormalB)
+ , Clause(Clause)
+ , Con(NormalC)
+ , Dec(DataD, FunD, SigD)
+ , DerivClause(DerivClause)
+ , Exp(LitE)
+ , Lit(IntegerL)
, Name
- , Pat (ConP)
+ , Pat(ConP)
, Q
- , Type (AppT, ArrowT, ConT)
+ , Type(AppT, ArrowT, ConT)
, mkName
)
@@ -38,11 +37,7 @@ import Language.Haskell.TH
-- and a function `pinLine :: GPIOPin -> Int`.
makeSerial :: String -> String -> String -> Name -> [Int] -> Q [Dec]
makeSerial name suffix mapFun mapType idxs =
- return
- [ DataD [] dtName [] Nothing (idxCons <$> idxs) [derivClause]
- , SigD mapFunName . AppT (AppT ArrowT $ ConT dtName) $ ConT mapType
- , FunD mapFunName $ mapFunClause <$> idxs
- ]
+ return [DataD [] dtName [] Nothing (idxCons <$> idxs) [derivClause], SigD mapFunName . AppT (AppT ArrowT $ ConT dtName) $ ConT mapType, FunD mapFunName $ mapFunClause <$> idxs]
where
dtName = mkName $ name <> suffix
idxName idx = mkName $ name <> show idx