template-haskell
Polynomial factorization in Haskell
With hammar\'s help I have made a template Haskell bit which compiles $(zModP 5) to newtype Z5 = Z5 Int[详细]
2023-04-11 16:43 分类:问答How to avoid extra indentation in Template Haskell declaration quotations?
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:[详细]
2023-04-09 13:58 分类:问答Data constructor in template haskell
I\'m trying to create the ring Z/n (like normal arithmetic, but modulo some integer). An example instance is Z4:[详细]
2023-04-07 14:20 分类:问答How to dynamically call a function which defined in multiple modules in the same signature
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:[详细]
2023-04-02 18:11 分类:问答How to get rid of $(...) and [| ... |] syntax when using a Template Haskell function?
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:[详细]
2023-03-31 08:29 分类:问答How to examine a quoted data constructor name in Template Haskell?
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:[详细]
2023-03-31 08:28 分类:问答Shortening code by exploiting symmetry among multiple type class instances
Context I\'m writing a Haskell module that represents SI prefixes: module Unit.SI.Prefix where Each SI prefix has a corresponding data type:[详细]
2023-03-31 05:14 分类:问答Why doesn't Safe Haskell support Template Haskell?
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[详细]
2023-03-29 04:12 分类:问答Force pre-computation of a constant
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,[详细]
2023-03-08 01:39 分类:问答Emitting warnings from Template Haskell splices
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[详细]
2023-02-28 17:03 分类:问答