[commit: packages/bytestring] ghc-head: Add an IsString instance for Builder (89bda08)

git at git.haskell.org git at git.haskell.org
Thu Aug 29 10:18:54 CEST 2013


Repository : ssh://git@git.haskell.org/bytestring

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/bytestring.git;a=commit;h=89bda08fdf485b125befbd1dc9bec1c92d2d0a5f

>---------------------------------------------------------------

commit 89bda08fdf485b125befbd1dc9bec1c92d2d0a5f
Author: Bryan O'Sullivan <bos at serpentine.com>
Date:   Wed Feb 20 18:50:36 2013 -0800

    Add an IsString instance for Builder


>---------------------------------------------------------------

89bda08fdf485b125befbd1dc9bec1c92d2d0a5f
 Data/ByteString/Builder.hs |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Data/ByteString/Builder.hs b/Data/ByteString/Builder.hs
index f8dec8f..87650a4 100644
--- a/Data/ByteString/Builder.hs
+++ b/Data/ByteString/Builder.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE CPP, BangPatterns #-}
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-orphans #-}
 {- | Copyright   : (c) 2010 Jasper Van der Jeugt
                    (c) 2010 - 2011 Simon Meier
 License     : BSD3-style (see LICENSE)
@@ -263,6 +263,7 @@ import           Data.ByteString.Builder.Internal
 import qualified Data.ByteString.Builder.Prim  as P
 import qualified Data.ByteString.Lazy.Internal as L
 
+import           Data.String (IsString(..))
 import           System.IO (Handle)
 import           Foreign
 
@@ -450,3 +451,5 @@ charUtf8 = P.primBounded P.charUtf8
 stringUtf8 :: String -> Builder
 stringUtf8 = P.primMapListBounded P.charUtf8
 
+instance IsString Builder where
+    fromString = stringUtf8





More information about the ghc-commits mailing list