With hammar\'s help I have made a template Haskell bit which compiles $(zModP 5) to newtype Z5 = Z5 Int
I have a toy program: $ cat a.hs main = putStrLn \"Toy example\" $ runghc a.hs Toy example Let\'s add some Template Haskell to it:
I\'m trying to create the ring Z/n (like normal arithmetic, but modulo some integer). An example instance is Z4:
I\'ve defined a lot of functions (say, 100+), each of which do a specific work but with the same signature. That is something like:
I\'m trying to learn some Template Haskell. As an exercise, I wrote a function that can generate things like isLeft and isRight (inspired by this question). Here\'s my humble attempt:
I\'m trying to learn some Template Haskell. As an exercise, I wrote a function that can generate things like isLeft and isRight (inspired by this question). Here\'s my humble attempt:
Context I\'m writing a Haskell module that represents SI prefixes: module Unit.SI.Prefix where Each SI prefix has a corresponding data type:
The documentation for Safe Haskell states: [...] Unfortunately Template Haskell can be used to subvert module boundaries and so could be used gain access to this constructor. [...] The use of the -X
I have a constant declaration in Haskell -- can I force this to be evaluated ahead of time? I\'m seeing some code that looks roughly like,
I know that I can cause a compile-time error by calling fail from a splice, but is it possible to only generate a warning? In particular I would like it to be possible to turn this warning into an err