5

Haskellsendfileパッケージで次のコードを見つけました。

http://patch-tag.com/r/mae/sendfile/snapshot/current/content/pretty/src/Network/Socket/SendFile/Linux.hsc

-- sendfile64 gives LFS support
foreign import ccall unsafe "sendfile64" c_sendfile
  :: Fd -> Fd -> Ptr (#type off64_t) -> (#type size_t) -> IO (#type ssize_t)

1)#type意味と 2) なぜこのエラーが発生するのか

[1 of 1] Compiling Linux.Splice     ( splice.hs, splice.o )

splice.hs:40:12: parse error on input `type'

私自身が次のように使用しようとすると?:

ghc --make splice.hs

スプライス.hs:

{-# LANGUAGE ForeignFunctionInterface #-}

module Linux.Splice where

import Data.Word
import System.Posix.Types

-- SPLICE

 -- fcntl.h
 -- ssize_t splice(
 --   int          fd_in,
 --   loff_t*      off_in,
 --   int          fd_out,
 --   loff_t*      off_out,
 --   size_t       len,
 --   unsigned int flags
 -- );

foreign import ccall unsafe "fnctl.h splice" c_splice
  :: Fd
  -> Ptr (#type {- < parse error -} loff_t)
  -> Fd
  -> Ptr (#type loff_t)
  -> (#type size_t)
  -> Word
  -> IO (#type ssize_t)

(GHC 7.4.x を使用)

4

1 に答える 1