Mon Feb 1 14:05:46 CST 2010 Jeremy Shaw * added Data instance for Data.Text.Text For more information see: "could we get a Data instance for Data.Text.Text?" http://groups.google.com/group/haskell-cafe/browse_thread/thread/b5bbb1b28a7e525d/0639d46852575b93 Fri Feb 5 11:21:29 CST 2010 Jeremy Shaw * Data Text: Used mispelled mkNorepType for compatibility with GHC 6.10 New patches: [added Data instance for Data.Text.Text Jeremy Shaw **20100201200546 Ignore-this: 9a2bff651d05b689951a4703e63da940 For more information see: "could we get a Data instance for Data.Text.Text?" http://groups.google.com/group/haskell-cafe/browse_thread/thread/b5bbb1b28a7e525d/0639d46852575b93 ] hunk ./Data/Text.hs 169 Eq(..), Ord(..), (++), Read(..), Show(..), (&&), (||), (+), (-), (.), ($), (>>), (*), - div, not, return, otherwise) + div, error, not, return, otherwise) #if defined(HAVE_DEEPSEQ) import Control.DeepSeq (NFData) #endif hunk ./Data/Text.hs 175 import Control.Exception (assert) import Data.Char (isSpace) +import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), mkNoRepType) import Control.Monad (foldM) import Control.Monad.ST (ST) import qualified Data.Text.Array as A hunk ./Data/Text.hs 225 instance NFData Text #endif +-- This instance preserves data abstraction at the cost of inefficiency. +-- We omit reflection services for the sake of data abstraction. +-- +-- This instance was created by copying the behavior of Data.Set and +-- Data.Map. If you feel a mistake has been made, please feel free to +-- submit improvements. +-- +-- Original discussion is archived here: + +-- "could we get a Data instance for Data.Text.Text?" +-- http://groups.google.com/group/haskell-cafe/browse_thread/thread/b5bbb1b28a7e525d/0639d46852575b93 +-- +instance Data Text where + gfoldl f z txt = z pack `f` (unpack txt) + toConstr _ = error "Data.Text.Text:toConstr" + gunfold _ _ = error "Data.Text.Text:gunfold" + dataTypeOf _ = mkNoRepType "Data.Text.Text" + -- ----------------------------------------------------------------------------- -- * Conversion to/from 'Text' [Data Text: Used mispelled mkNorepType for compatibility with GHC 6.10 Jeremy Shaw **20100205172129 Ignore-this: e88eee33ae7a3a6d763bf2ff7b238271 ] hunk ./Data/Text.hs 175 #endif import Control.Exception (assert) import Data.Char (isSpace) -import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), mkNoRepType) +import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), mkNorepType) import Control.Monad (foldM) import Control.Monad.ST (ST) import qualified Data.Text.Array as A hunk ./Data/Text.hs 237 -- "could we get a Data instance for Data.Text.Text?" -- http://groups.google.com/group/haskell-cafe/browse_thread/thread/b5bbb1b28a7e525d/0639d46852575b93 -- +-- NOTE: we used the mispelled version of mkNoRepType for +-- compatibility with GHC 6.10. Eventually this should be updated: +-- http://hackage.haskell.org/trac/ghc/ticket/2760 instance Data Text where gfoldl f z txt = z pack `f` (unpack txt) toConstr _ = error "Data.Text.Text:toConstr" hunk ./Data/Text.hs 244 gunfold _ _ = error "Data.Text.Text:gunfold" - dataTypeOf _ = mkNoRepType "Data.Text.Text" + dataTypeOf _ = mkNorepType "Data.Text.Text" -- ----------------------------------------------------------------------------- -- * Conversion to/from 'Text' Context: [TAG 0.7.0.1 Bryan O'Sullivan **20091223174807 Ignore-this: 1eda25329c43526a02aef9bc6976c245 ] Patch bundle hash: 3004bedbadadf804724a404bce6c69c6fb064a2c