summaryrefslogtreecommitdiff
path: root/dht/Data/BitSyntax.hs
diff options
context:
space:
mode:
Diffstat (limited to 'dht/Data/BitSyntax.hs')
-rw-r--r--dht/Data/BitSyntax.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/dht/Data/BitSyntax.hs b/dht/Data/BitSyntax.hs
index 6d14d0c1..9ebffe73 100644
--- a/dht/Data/BitSyntax.hs
+++ b/dht/Data/BitSyntax.hs
@@ -1,5 +1,6 @@
1{-# LANGUAGE TemplateHaskell #-} 1{-# LANGUAGE CPP #-}
2{-# LANGUAGE ForeignFunctionInterface #-} 2{-# LANGUAGE ForeignFunctionInterface #-}
3{-# LANGUAGE TemplateHaskell #-}
3-- | This module contains fuctions and templates for building up and breaking 4-- | This module contains fuctions and templates for building up and breaking
4-- down packed bit structures. It's something like Erlang's bit-syntax (or, 5-- down packed bit structures. It's something like Erlang's bit-syntax (or,
5-- actually, more like Python's struct module). 6-- actually, more like Python's struct module).
@@ -278,7 +279,11 @@ readElement (stmts, inputname, tuplenames) (Context funcname) = do
278 let stmt = BindS (TupP [VarP valname, VarP restname]) 279 let stmt = BindS (TupP [VarP valname, VarP restname])
279 (AppE (AppE (VarE funcname) 280 (AppE (AppE (VarE funcname)
280 (VarE inputname)) 281 (VarE inputname))
282#if MIN_VERSION_template_haskell(2,16,0)
283 (TupE $ map (Just . VarE) $ reverse tuplenames))
284#else
281 (TupE $ map VarE $ reverse tuplenames)) 285 (TupE $ map VarE $ reverse tuplenames))
286#endif
282 287
283 return (stmt : stmts, restname, valname : tuplenames) 288 return (stmt : stmts, restname, valname : tuplenames)
284 289