#1800: Template Haskell support for running functions defined in the same  
module
---------------------------------+------------------------------------------
    Reporter:  simonpj           |        Owner:         
        Type:  feature request   |       Status:  new    
    Priority:  normal            |    Milestone:  _|_    
   Component:  Template Haskell  |      Version:  6.6.1  
    Severity:  normal            |   Resolution:         
    Keywords:                    |   Difficulty:  Unknown
          Os:  Unknown           |     Testcase:         
Architecture:  Unknown           |  
---------------------------------+------------------------------------------
Comment (by guest):

 It would be interesting to note how the template-haskell end user copes
 with this problem to illustrate why the proposed feature is useful.

 I myself have had to face this problem when designing an embedded compiler
 for system design.
 Doe to the mentioned limitation I'm normally forced to "push" the
 arguments out of the splice.

 As a (simplified) example, in my System Modelling DSL I have to create
 system definition. That is done by providing the function Name together
 with the identifiers of its inputs and outputs.

 {{{
 inputs = ["in1", "in2"]

 outputs = ["out1", "out2"]

 f :: Signal Int -> Signal Int -> (Signal Int, Signal Int)
 f = ...
 }}}

 Since it is not possible to do

 {{{
 system :: SysDef
 system = $(mkSysDef 'f inputs outputs)
 }}}

 due to the limitation explained in this ticket. I'm forced to do:

 {{{
 system :: SysDef
 system = $(mkSysDef 'f) inputs outputs

 -- where mkSysDef :: Name -> ExpQ
 }}}

 My solution does not solve the problem. It rather bypasses it.

 Furthermore, mkSysDef unfortunately cannot do static checking (for
 example, it cannot make sure that all the inputs and outputs have
 different identifiers). However, that's better than asking the user to
 create the system definitions and identifiers in different modules.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1800#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to