On 1 October 2011 08:30, Volker Wysk <p...@volker-wysk.de> wrote: > 1. > > data FD = FD { > fdFD :: {-# UNPACK #-} !CInt, > fdIsNonBlocking :: {-# UNPACK #-} !Int > } > > What is that exclamation mark?
That's a strictness annotation and is haskell98/2010: http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-680004.2 And that "{-# UNPACK #-}"? To quote: http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html#unpack-pragma "The UNPACK indicates to the compiler that it should unpack the contents of a constructor field into the constructor itself, removing a level of indirection" > 2. > > handleToFd' :: Handle -> Handle__ -> IO (Handle__, Fd) > handleToFd' h h_@Handle__{haType=_,..} = do > case cast haDevice of > -- ... > > haDevice should be a function. How could you cast it? Note the .. in the record pattern. That is a language extension called RecordWildCards. It replaces each elided field f by the pattern f = f: http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#record-wildcards > 3. > > data Handle__ > = forall dev enc_state dec_state . > (IODevice dev, BufferedIO dev, Typeable dev) => > Handle__ { > -- ... > } > deriving Typeable > > What's that "forall" thing? Handle__ is an existentially quantified data constructors: http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#existential-quantification > 4. > > handleToFd' h h_@Handle__{haType=_,..} = do > case cast haDevice of > Nothing -> -- ... > Just fd -> do > -- ... > return (Handle__{haType=ClosedHandle,..}, > Fd (fromIntegral (FD.fdFD fd))) > > What's this ".." inside "Handle__{haType=ClosedHandle,..}"? See answer of 2 Regards, Bas _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users