summaryrefslogtreecommitdiff
path: root/src/StaticAssert.hs
blob: d0784c9750d48446dd2c584794e0ac1a12634033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module StaticAssert where

import Network.Socket (htonl)
import Language.Haskell.TH

staticAssert :: Bool -> Q [Dec]
staticAssert cond = case cond of
    True  -> return []
    False -> fail "staticAssert failed"

isLittleEndian :: Bool
isLittleEndian = htonl 0x01000000 == 1