diff options
Diffstat (limited to 'src/StaticAssert.hs')
-rw-r--r-- | src/StaticAssert.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/StaticAssert.hs b/src/StaticAssert.hs new file mode 100644 index 00000000..d0784c97 --- /dev/null +++ b/src/StaticAssert.hs | |||
@@ -0,0 +1,13 @@ | |||
1 | module StaticAssert where | ||
2 | |||
3 | import Network.Socket (htonl) | ||
4 | import Language.Haskell.TH | ||
5 | |||
6 | staticAssert :: Bool -> Q [Dec] | ||
7 | staticAssert cond = case cond of | ||
8 | True -> return [] | ||
9 | False -> fail "staticAssert failed" | ||
10 | |||
11 | isLittleEndian :: Bool | ||
12 | isLittleEndian = htonl 0x01000000 == 1 | ||
13 | |||