Add IsString class for overloaded string literals.
authorlennart@augustsson.net <unknown>
Thu, 21 Dec 2006 21:05:32 +0000 (21:05 +0000)
committerlennart@augustsson.net <unknown>
Thu, 21 Dec 2006 21:05:32 +0000 (21:05 +0000)
Foreign/Marshal/Pool.hs
GHC/Base.lhs
Prelude.hs

index a2a73ac..3f7e2d5 100644 (file)
@@ -45,7 +45,7 @@ module Foreign.Marshal.Pool (
 ) where
 
 #ifdef __GLASGOW_HASKELL__
-import GHC.Base              ( Int, Monad(..), (.), not )
+import GHC.Base              ( Int, Monad(..), IsString(..), (.), not )
 import GHC.Err               ( undefined )
 import GHC.Exception         ( block, unblock, throw, catchException )
 import GHC.IOBase            ( IO, IORef, newIORef, readIORef, writeIORef, )
index 4fc09a6..5522e23 100644 (file)
@@ -496,6 +496,14 @@ otherwise          :: Bool
 otherwise              =  True
 \end{code}
 
+\begin{code}
+class IsString a where
+    fromString :: String -> a
+
+instance IsString [Char] where
+    fromString xs = xs
+\end{code}
+
 
 %*********************************************************
 %*                                                     *
index 840c2ca..cae9c25 100644 (file)
@@ -80,6 +80,9 @@ module Prelude (
     Functor(fmap),
     mapM, mapM_, sequence, sequence_, (=<<),
 
+    -- ** String class
+    IsString(fromString),
+
     -- ** Miscellaneous functions
     id, const, (.), flip, ($), until,
     asTypeOf, error, undefined,