[GHC] #3541: Allow local foreign imports

View: New views
3 Messages — Rating Filter:   Alert me  

[GHC] #3541: Allow local foreign imports

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#3541: Allow local foreign imports
-----------------------------+----------------------------------------------
Reporter:  mokus             |          Owner:                  
    Type:  feature request   |         Status:  new            
Priority:  normal            |      Component:  Compiler (FFI)  
 Version:  6.10.4            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 I have no idea the level of difficulty this would entail, but it would be
 rather nice to be able to import foreign functions at scopes other than
 the top level.  When writing glue code, especially for C++ where I often
 want to catch and haskellize exceptions, I find myself using wrappers
 quite a bit, for example:

 {{{
 foreign import ccall "foo.h foo"
     raw_foo :: CString -> IO ()
 foo :: String -> IO ()
 foo s = withCString s raw_foo
 }}}

 Where I only want "foo" exported from the module.  It's not that big a
 deal to list explicit exports, I know, but I would like to be able to say
 instead:

 {{{
 foo :: String -> IO ()
 foo s = withCString s raw_foo
     where
         foreign import ccall "foo.h foo" raw_foo :: CString -> IO ()
 }}}

 In addition to reducing clutter in the top level namespace, it makes for
 less clutter on the left margin of the code, making it easier to scan
 through function names visually.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3541>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #3541: Allow local foreign imports

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#3541: Allow local foreign imports
---------------------------------+------------------------------------------
    Reporter:  mokus             |        Owner:                  
        Type:  feature request   |       Status:  new            
    Priority:  normal            |    Milestone:  6.14.1          
   Component:  Compiler (FFI)    |      Version:  6.10.4          
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown        
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown
  * milestone:  => 6.14.1

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3541#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #3541: Allow local foreign imports

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#3541: Allow local foreign imports
---------------------------------+------------------------------------------
    Reporter:  mokus             |        Owner:                  
        Type:  feature request   |       Status:  new            
    Priority:  normal            |    Milestone:  _|_            
   Component:  Compiler (FFI)    |      Version:  6.10.4          
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Moderate (1 day)
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * difficulty:  Unknown => Moderate (1 day)
  * milestone:  6.14.1 => _|_

Comment:

 Let's leave this as an unmilestoned feature request for now.  It's
 something that a contributor could tackle.

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