[Haskell-cafe] FunPtr error?

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Jun 9 01:54:28 EDT 2008


Hello Vasili,

Monday, June 9, 2008, 6:17:14 AM, you wrote:

1. standard place to import FunPtr from is Foreign.Ptr, not System.Posix
2. FunPtr is exported as abstract type, without constructors. you
can't construct values of this type directly. instead you should use
"wrapper" generators as in the example that Clause has wrote. read it
carefully :)


> Hello,

>      I am getting what is to me a mysterious error in a test case that I am writing:
> vigalchin at ubuntu:~/FTP/Haskell/unix-2.2.0.0/tests/timer$ runhaskell Setup.lhs build
> Preprocessing executables for Test-1.0...
>  Building Test-1.0...
> [1 of 1] Compiling Main             ( ./timer.hs,
> dist/build/timer/timer-tmp/Main.o )

> ./timer.hs:11:45: Not in scope: data constructor `FunPtr'

> It seems like the compiler is complaining about the lack of FunPtr
> in it's symbol table but System.Posix is imported:
>  
> module Main where

> import System.Posix
> import Foreign
> import Foreign.C
> import Foreign.Ptr

> main = do

>          let event = Sigevent{sigevFunction=(FunPtr (notifyFunc))}  <<<<<< error here
>  
>          timerId <- timerCreate Clock_Realtime Nothing

>          timerDelete timerId

>          return ()

> notifyFunc :: Sigval -> IO ()
> notifyFunc sigval = do
>    putStrLn "timer POP!!!!!!!"
>     return ()

> I am probably looking right at the answer and not seeing it. ??

> Thanks, Vasili



>   


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list