#5529: Newtypes with hidden constructors cannot be passed as FFI arguments
-----------------------------------+----------------------------------------
    Reporter:  mikhail.vorozhtsov  |        Owner:              
        Type:  bug                 |       Status:  new         
    Priority:  normal              |    Milestone:              
   Component:  Compiler            |      Version:  7.3         
    Keywords:                      |     Testcase:              
   Blockedby:                      |   Difficulty:              
          Os:  Unknown/Multiple    |     Blocking:              
Architecture:  Unknown/Multiple    |      Failure:  None/Unknown
-----------------------------------+----------------------------------------

Comment(by simonpj):

 I can see merit in Mkhail's point of view.

 Example
 {{{
 module Colours( Colour, red, draw ) where

 newtype Colour = C Int

 red :: Colour
 red = 7

 foreign import "draw" :: Colour -> IO ()
 }}}
 The question is whether this should be legal
 {{{
 module Foo where
 import Colours
 foriegn import "draw2" :: Colour -> IO ()
 }}}
 That is, a client of `Colours` can call a `draw2` function that unpacks
 the `Colour`.  Or should the abstract data type `Colour` be restricted to
 the functions (foreign or otherwise) that `Colours` exports?

 I don't have a strong opinion. Did we make the change in response to a bug
 report?  Ie was someone arguing the opposite?


 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5529#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to