From dec25325b97648b3cff5230c8b3c51916ae2c0e2 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 1 Jan 2019 14:36:05 +0100 Subject: Fix Semigroup instances --- src/Test/VeriFuzz/Verilog/AST.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Test/VeriFuzz/Verilog/AST.hs b/src/Test/VeriFuzz/Verilog/AST.hs index 8a4692e..5fa2d51 100644 --- a/src/Test/VeriFuzz/Verilog/AST.hs +++ b/src/Test/VeriFuzz/Verilog/AST.hs @@ -143,11 +143,13 @@ instance Num Expr where fromInteger = Number 32 . fromInteger instance Semigroup Expr where - a <> b = mconcat [a, b] + (Concat a) <> (Concat b) = Concat $ a <> b + (Concat a) <> b = Concat $ a <> [b] + a <> (Concat b) = Concat $ a : b + a <> b = Concat [a, b] instance Monoid Expr where mempty = 0 - mconcat = Concat instance IsString Expr where fromString = Str . fromString @@ -224,11 +226,13 @@ data Stmnt = TimeCtrl { _statDelay :: Delay deriving (Eq) instance Semigroup Stmnt where - a <> b = mconcat [a, b] + (SeqBlock a) <> (SeqBlock b) = SeqBlock $ a <> b + (SeqBlock a) <> b = SeqBlock $ a <> [b] + a <> (SeqBlock b) = SeqBlock $ a : b + a <> b = SeqBlock [a, b] instance Monoid Stmnt where mempty = EmptyStat - mconcat = SeqBlock data Task = Task { _taskName :: Identifier , _taskExpr :: [Expr] -- cgit