Skip to content

Commit

Permalink
🎨 Use GADTs to circumvent the formatting issues with ormolu
Browse files Browse the repository at this point in the history
  • Loading branch information
lsrcz committed Mar 15, 2024
1 parent 4f1ac16 commit 5bcddd9
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/Grisette/Core/Data/Union.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE DeriveLift #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -76,21 +77,22 @@ import Data.Text.Prettyprint.Doc (align, group, nest, vsep)
#endif

-- | The default union implementation.
data Union a
= -- | A single value
UnionSingle a
| -- | A if value
UnionIf
a
-- ^ Cached leftmost value
!Bool
-- ^ Is merged invariant already maintained?
!SymBool
-- ^ If condition
(Union a)
-- ^ True branch
(Union a)
-- ^ False branch
data Union a where
-- | A single value
UnionSingle :: a -> Union a
-- | A if value
UnionIf ::
-- | Cached leftmost value
a ->
-- | Is merged invariant already maintained?
!Bool ->
-- | If condition
!SymBool ->
-- | True branch
Union a ->
-- | False branch
Union a ->
Union a
deriving (Generic, Eq, Lift, Generic1)
deriving (Functor)

Expand Down

0 comments on commit 5bcddd9

Please sign in to comment.