diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/Main.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/Main.hs b/test/Main.hs index 4fdf4ad..209b88e 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -9,7 +9,6 @@ module Main where import Data.Dependent.EnumMap.Strict qualified as DE import Data.Dependent.Sum -import Data.Some data Tag = A | B | C @@ -22,9 +21,9 @@ data STag tag where deriving instance Show (STag tag) instance DE.Enum1 STag where - type Enum1Info STag = () - fromEnum1 = \case { SA -> (0, ()); SB -> (1, ()); SC -> (2, ()) } - toEnum1 n () = case n of { 0 -> Some SA; 1 -> Some SB; 2 -> Some SC; _ -> error "invalid tag" } + type Enum1Info STag = STag + fromEnum1 = \case { SA -> (0, SA); SB -> (1, SB); SC -> (2, SC) } + toEnum1 n t = case (n, t) of { (0, SA) -> SA; (1, SB) -> SB; (2, SC) -> SC; _ -> error "invalid tag" } data Value tag where VA :: Int -> Value A |
