Questions tagged [reify]

To "reify" means to take an abstract concept and make a concrete representation out of it. For example, in Lisp lambdas allow you to reify the concepts of procedure abstraction and application.

30 questions
260
votes
1 answer

Getting associated type synonyms with template Haskell

Can Template Haskell find out the names and/or the declarations of the associated type synonyms declared in a type class? I expected reify would do what I want, but it doesn't seem to provide all the necessary information. It works for getting…
21
votes
1 answer

What do "idealTree" and "reify" mean in the context of npm?

When creating a react app via "npx create-react-app [app_name]" I noticed the console log something like [#############] idealTree:[package-name]... and then the same thing with "reify" instead of "idealTree". When I search what these terms mean I…
18
votes
1 answer

Get a Haskell record's field names as a list of strings?

Say I have the following: data Rec = Rec { alpha :: Int, beta :: Double, phi :: Float } sample = Rec 1 2.3 4.5 I understand Template Haskell & the reify function can get me the record's field names. That is: print $(f sample) -->…
user1002430
15
votes
1 answer

Is it possible to get a type of any expression using Template Haskell?

Given an expression foo, I could declare a top-level function bar = foo and get the type of foo as Type by reifying bar: case reify 'bar of VarI _ t _ _ -> t Is there a direct way of getting the type of foo, without creating the redundant…
Petr
  • 62,528
  • 13
  • 153
  • 317
10
votes
0 answers

npm install hangs at " reify:tailwindcss: timing build:queue Completed in 141ms"

It always hangs at the same place: reify:tailwindcss: timing build:queue Completed in [number]ms I've even tried just walking away and leaving it overnight to no avail. What's really frustrating is this worked on another project for me about a week…
aylnon
  • 371
  • 2
  • 8
10
votes
1 answer

How to get the declaration of a function using `reify`?

Function reify allows me to look up information about a given name. For a function the returned value is VarI: data Info = ... | VarI Name Type (Maybe Dec) Fixity | ... Here I can examine the function's type, and I'd also like to examine its…
Petr
  • 62,528
  • 13
  • 153
  • 317
7
votes
2 answers

How to reify Prolog's backtracking state to perform the same task as "lazy seq" from Clojure?

Here is a quicksort algorithm for numbers written in Clojure. It is basically the quicksort algorithm found in "The Joy of Clojure", 2nd edition, page 133. I modified it slightly for (hopefully) better readability, because the original felt a bit…
David Tonhofer
  • 14,559
  • 5
  • 55
  • 51
7
votes
1 answer

Is there a way how to enumerate all functions in a module using Template Haskell?

While I can use reify to get information about most other syntactic constructs, I couldn't find anything that would give some information about a module.
Petr
  • 62,528
  • 13
  • 153
  • 317
6
votes
1 answer

Can some explain the reflection package API in *very* simple terms?

I'm having a hard time understanding the documentation/examples out there describing the reflection package. I'm an imperative-programming veteran but a Haskell newb. Can you walk me through a very simple introduction? Package:…
AgentLiquid
  • 3,632
  • 7
  • 26
  • 30
6
votes
4 answers

Use a clojure macro to automatically create getters and setters inside a reify call

I am trying to implement a huge Java interface with numerous (~50) getter and setter methods (some with irregular names). I thought it would be nice to use a macro to reduce the amount of code. So instead of (def data (atom {:x nil})) (reify…
Arthur Edelstein
  • 1,567
  • 1
  • 10
  • 11
6
votes
2 answers

Explanation for reification in RDF

I am have understand the basics of reification in RDF. Two clearly explanations are given here: explanation 1 and explanation 2. If you observe carefully, actually we can present in the sentence "Earth is round" RDF triple where as "Scientist…
Nusrat
  • 699
  • 1
  • 5
  • 16
5
votes
1 answer

Provide a constructor with Clojure reify

When using reify in Clojure, how can I provide an expression for the constructor? Alternatively, how can I pass arguments to the base class constructor?
pauldoo
  • 18,087
  • 20
  • 94
  • 116
5
votes
1 answer

How to reify Java Interfaces with overloaded method?

I am trying to 'implement' the following Java interface from JGroups with reify. public interface MessageListener extends StateListener { /** * Called when a message is received. * @param msg */ void receive(Message msg); …
javahippie
  • 806
  • 10
  • 25
4
votes
1 answer

Clojure: implementing stateful Java interface

Kafka Streams has an interface, Processor, the implementation of which is stateful. An example implementation given in the developer guide is: public class WordCountProcessor implements Processor { private ProcessorContext…
Tianxiang Xiong
  • 3,887
  • 9
  • 44
  • 63
3
votes
1 answer

How to override a method of an existing object?

The object was created with reify and I need to override one of its method. The only way I found is to use classic OO decorator with another use of reify. Is there any other way?
Pol
  • 5,064
  • 4
  • 32
  • 51
1
2