Proposal: Add Data.String, containing IsString(fromString), to base

Ian Lynagh igloo at earth.li
Tue Jan 30 08:54:02 EST 2007


http://hackage.haskell.org/trac/ghc/ticket/1126

Proposal to create a new module Data.String, containing
IsString(fromString), in the base package. This would be used by the
overloaded strings extension (-foverloaded-strings in GHC).

Deadline: 28 Feb 2007


Here's the meat of the patch:

hunk ./Data/String.hs 1
+{-# 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 at 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


Thanks
Ian



More information about the Libraries mailing list