diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-04-26 11:41:15 +0200 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-04-26 11:41:15 +0200 |
commit | bd332a54485cbc47e756cf1169a9fae48fc5dd2a (patch) | |
tree | 7dc903288510ad9c1749656f854cda2332308805 /src | |
parent | 926cdbd3f6abcb3b475469a448c9aea2033d688f (diff) |
eliminate an error call
Diffstat (limited to 'src')
-rw-r--r-- | src/LambdaCube/Compiler/Utils.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/LambdaCube/Compiler/Utils.hs b/src/LambdaCube/Compiler/Utils.hs index 7de304a9..71e4081b 100644 --- a/src/LambdaCube/Compiler/Utils.hs +++ b/src/LambdaCube/Compiler/Utils.hs | |||
@@ -1,5 +1,6 @@ | |||
1 | {-# LANGUAGE NoMonomorphismRestriction #-} | 1 | {-# LANGUAGE NoMonomorphismRestriction #-} |
2 | {-# LANGUAGE ScopedTypeVariables #-} | 2 | {-# LANGUAGE ScopedTypeVariables #-} |
3 | {-# LANGUAGE EmptyCase #-} | ||
3 | module LambdaCube.Compiler.Utils where | 4 | module LambdaCube.Compiler.Utils where |
4 | 5 | ||
5 | import qualified Data.IntSet as IS | 6 | import qualified Data.IntSet as IS |
@@ -12,13 +13,17 @@ iterateN n f e = iterate f e !! n | |||
12 | unfoldNat z s 0 = z | 13 | unfoldNat z s 0 = z |
13 | unfoldNat z s n | n > 0 = s $ unfoldNat z s (n-1) | 14 | unfoldNat z s n | n > 0 = s $ unfoldNat z s (n-1) |
14 | 15 | ||
16 | ---------------------- | ||
17 | |||
15 | data Void | 18 | data Void |
16 | 19 | ||
17 | instance Show Void where show = elimVoid | 20 | instance Show Void where show = elimVoid |
18 | instance Eq Void where x == y = elimVoid x | 21 | instance Eq Void where x == y = elimVoid x |
19 | 22 | ||
20 | elimVoid :: Void -> a | 23 | elimVoid :: Void -> a |
21 | elimVoid _ = error "impossible" | 24 | elimVoid v = case v of |
25 | |||
26 | ---------------------- | ||
22 | 27 | ||
23 | -- supplementary data: data with no semantic relevance | 28 | -- supplementary data: data with no semantic relevance |
24 | newtype SData a = SData a | 29 | newtype SData a = SData a |