Add Data.String, containing IsString(fromString); trac proposal #1126
authorIan Lynagh <igloo@earth.li>
Tue, 30 Jan 2007 13:48:41 +0000 (13:48 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 30 Jan 2007 13:48:41 +0000 (13:48 +0000)
This is used by the overloaded strings extension (-foverloaded-strings in GHC).

Data/String.hs [new file with mode: 0644]
Foreign/Marshal/Pool.hs
GHC/Base.lhs
base.cabal
package.conf.in

diff --git a/Data/String.hs b/Data/String.hs
new file mode 100644 (file)
index 0000000..f1a65cd
--- /dev/null
@@ -0,0 +1,31 @@
+{-# OPTIONS_GHC -fno-implicit-prelude #-}
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.String
+-- Copyright   :  (c) The University of Glasgow 2007
+-- License     :  BSD-style (see the file libraries/base/LICENSE)
+--
+-- Maintainer  :  libraries@haskell.org
+-- Stability   :  experimental
+-- Portability :  portable
+--
+-- Things related to the String type.
+--
+-----------------------------------------------------------------------------
+
+module Data.String (
+   IsString(..)
+ ) where
+
+#ifdef __GLASGOW_HASKELL__
+import GHC.Base
+#endif
+
+-- | Class for string-like datastructures; used by the overloaded string
+--   extension (-foverloaded-strings in GHC).
+class IsString a where
+    fromString :: String -> a
+
+instance IsString [Char] where
+    fromString xs = xs
+
index 3f7e2d5..a2a73ac 100644 (file)
@@ -45,7 +45,7 @@ module Foreign.Marshal.Pool (
 ) where
 
 #ifdef __GLASGOW_HASKELL__
-import GHC.Base              ( Int, Monad(..), IsString(..), (.), not )
+import GHC.Base              ( Int, Monad(..), (.), not )
 import GHC.Err               ( undefined )
 import GHC.Exception         ( block, unblock, throw, catchException )
 import GHC.IOBase            ( IO, IORef, newIORef, readIORef, writeIORef, )
index 5522e23..c590366 100644 (file)
@@ -496,15 +496,6 @@ otherwise          :: Bool
 otherwise              =  True
 \end{code}
 
-\begin{code}
-class IsString a where
-    fromString :: String -> a
-
-instance IsString [Char] where
-    fromString xs = xs
-\end{code}
-
-
 %*********************************************************
 %*                                                     *
 \subsection{The @()@ type}
index 071e81e..aacd081 100644 (file)
@@ -77,6 +77,7 @@ exposed-modules:
        Data.STRef.Strict,
        Data.Sequence,
        Data.Set,
+       Data.String,
        Data.Tree,
        Data.Traversable,
        Data.Tuple,
index d9b23d4..e6374dd 100644 (file)
@@ -75,6 +75,7 @@ exposed-modules:
        Data.STRef.Strict,
        Data.Sequence,
        Data.Set,
+       Data.String,
        Data.Traversable,
        Data.Tree,
        Data.Tuple,