summaryrefslogtreecommitdiff
path: root/compiler/prelude/ForeignCall.lhs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-02-17 20:56:11 +0000
committerIan Lynagh <igloo@earth.li>2012-02-17 20:56:11 +0000
commit1b7dfd7f50fb16e30b6f3512f2ad4e1946a458ee (patch)
treea5b88d7a2bf2d6b6da109e374ecd2740905d0645 /compiler/prelude/ForeignCall.lhs
parent5d7fd2935f0ce419ffbd4718cc66487368fde53e (diff)
downloadhaskell-1b7dfd7f50fb16e30b6f3512f2ad4e1946a458ee.tar.gz
Small refactoring: Use (Maybe Header) rather than FastString
Diffstat (limited to 'compiler/prelude/ForeignCall.lhs')
-rw-r--r--compiler/prelude/ForeignCall.lhs15
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/prelude/ForeignCall.lhs b/compiler/prelude/ForeignCall.lhs
index 3fd0a183e5..0a8db5c5a5 100644
--- a/compiler/prelude/ForeignCall.lhs
+++ b/compiler/prelude/ForeignCall.lhs
@@ -15,7 +15,7 @@ module ForeignCall (
CCallTarget(..), isDynamicTarget,
CCallConv(..), defaultCCallConv, ccallConvToInt, ccallConvAttribute,
- CType(..),
+ Header(..), CType(..),
) where
import FastString
@@ -230,9 +230,13 @@ instance Outputable CCallSpec where
\end{code}
\begin{code}
+-- The filename for a C header file
+newtype Header = Header FastString
+ deriving (Eq, Data, Typeable)
+
-- | A C type, used in CAPI FFI calls
-data CType = CType (Maybe FastString) -- header to include for this type
- FastString -- the type itself
+data CType = CType (Maybe Header) -- header to include for this type
+ FastString -- the type itself
deriving (Data, Typeable)
\end{code}
@@ -324,4 +328,9 @@ instance Binary CType where
get bh = do mh <- get bh
fs <- get bh
return (CType mh fs)
+
+instance Binary Header where
+ put_ bh (Header h) = put_ bh h
+ get bh = do h <- get bh
+ return (Header h)
\end{code}