[C2hs] [c2hs] #36: Allow parametrized yet monomorphic data types in {#pointer ... #}

c2hs cvs-ghc at haskell.org
Wed Jan 26 21:46:01 CET 2011


#36: Allow parametrized yet monomorphic data types in {#pointer ... #}
--------------------+-------------------------------------------------------
 Reporter:  guest   |        Type:  enhancement
   Status:  new     |    Priority:  normal     
Milestone:          |   Component:  general    
  Version:  0.16.2  |    Keywords:             
--------------------+-------------------------------------------------------
 Hello.

 Currently pointer declaration could only use non-parametrized types. But
 sometimes it's too restrictive. I think examples below are self-
 explanatory:


 This is OK but pointer is untyped
 {{{
 {#pointer *OKA__Hit as OKA_Hit #}
 }}}

 This doesn't work although it's perfectly sound. On syntactic level it may
 require addition of parenthesis.
 {{{
 {#pointer *OKA__Hit as OKA_Hit -> Hit Chan () #}

 ./Event.chs:23: (column 42) [ERROR]  >>> Syntax error!
   The phrase `Chan' is not allowed here.
 }}}

 There is workaround with type synonyms but it's not very elegant.
 {{{
 type Typedef = Hit Chan ()
 {#pointer *OKA__Hit as OKA_Hit -> Typedef #}
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/36>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell



More information about the C2hs mailing list