summaryrefslogtreecommitdiff
path: root/src/StaticAssert.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StaticAssert.hs')
-rw-r--r--src/StaticAssert.hs13
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 @@
1module StaticAssert where
2
3import Network.Socket (htonl)
4import Language.Haskell.TH
5
6staticAssert :: Bool -> Q [Dec]
7staticAssert cond = case cond of
8 True -> return []
9 False -> fail "staticAssert failed"
10
11isLittleEndian :: Bool
12isLittleEndian = htonl 0x01000000 == 1
13