Skip to content

Commit e72081e

Browse files
committed
OMap integration into the codegen
1 parent a99eba8 commit e72081e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lambda-buffers-codegen/lambda-buffers-codegen.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ library
9797
, lambda-buffers-compiler-pb >=0.1
9898
, lens >=5.2
9999
, mtl >=2.2
100+
, ordered-containers >=0.2
100101
, prettyprinter >=1.7
101102
, proto-lens >=0.7
102103
, text >=1.2

lambda-buffers-codegen/src/LambdaBuffers/Codegen/Haskell/Print.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module LambdaBuffers.Codegen.Haskell.Print (printTyDefOpaque, printTyDefNonOpaqu
33
import Control.Lens ((^.))
44
import Data.Char qualified as Char
55
import Data.Foldable (Foldable (toList))
6-
import Data.Map (Map)
76
import Data.Map qualified as Map
7+
import Data.Map.Ordered (OMap)
88
import Data.Set (Set)
99
import Data.Set qualified as Set
1010
import Data.Text qualified as Text
@@ -68,9 +68,9 @@ printHsTyRef (_, H.MkModuleName hsModName, H.MkTyName hsTyName) = pretty hsModNa
6868
-- | Used to distinguish from Opaques.
6969
newtype NonOpaqueTyBody = Sum PC.Sum
7070

71-
printTyDefNonOpaque :: PC.TyName -> Map (PC.InfoLess PC.VarName) PC.TyArg -> NonOpaqueTyBody -> Doc a
71+
printTyDefNonOpaque :: PC.TyName -> OMap (PC.InfoLess PC.VarName) PC.TyArg -> NonOpaqueTyBody -> Doc a
7272
printTyDefNonOpaque tyN args body =
73-
let argsDoc = sep (printTyArg <$> toList args) -- FIXME(bladyjoker): OMap on Constructors
73+
let argsDoc = sep (printTyArg <$> toList args)
7474
(keyword, bodyDoc) = printTyBody tyN body
7575
in group $ keyword <+> printTyName tyN <+> argsDoc <+> equals <+> bodyDoc
7676

@@ -83,7 +83,7 @@ printTyArg (PC.TyArg vn _ _) = printVarName vn
8383

8484
printTyBodySum :: PC.TyName -> PC.Sum -> Doc a
8585
printTyBodySum tyN (PC.Sum ctors _) =
86-
let ctorDocs = printCtor tyN <$> toList ctors -- FIXME(bladyjoker): OMap on Constructors
86+
let ctorDocs = printCtor tyN <$> toList ctors
8787
in group $
8888
if null ctors
8989
then mempty
@@ -109,7 +109,7 @@ printProd _ (PC.TupleI tup) = printTup tup
109109

110110
printRec :: PC.TyName -> PC.Record -> Doc a
111111
printRec tyN (PC.Record fields _) =
112-
let fieldDocs = printField tyN <$> toList fields -- FIXME(bladyjoker): OMap on Fields
112+
let fieldDocs = printField tyN <$> toList fields
113113
in group $ encloseSep lbrace rbrace (space <> comma <> space) fieldDocs
114114

115115
printTup :: PC.Tuple -> Doc a

0 commit comments

Comments
 (0)