mainland-pretty 0.2.2 → 0.2.3
raw patch · 3 files changed
+46/−37 lines, 3 filesdep ~containersdep ~srclocPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers, srcloc
API changes (from Hackage documentation)
+ Text.PrettyPrint.Mainland: hPutDoc :: Handle -> Doc -> IO ()
+ Text.PrettyPrint.Mainland: putDoc :: Doc -> IO ()
Files
- LICENSE +24/−1
- Text/PrettyPrint/Mainland.hs +15/−30
- mainland-pretty.cabal +7/−6
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2006-2012+Copyright (c) 2006-2011 The President and Fellows of Harvard College. Redistribution and use in source and binary forms, with or without@@ -24,3 +24,26 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++Copyright (c) 2011-2012, Geoffrey Mainland+All rights reserved.++Redistribution and use in source and binary forms, with or without modification,+are permitted provided that the following conditions are met:+1. Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Text/PrettyPrint/Mainland.hs view
@@ -1,34 +1,7 @@--- Copyright (c) 2006-2012--- The President and Fellows of Harvard College.------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions--- are met:--- 1. Redistributions of source code must retain the above copyright--- notice, this list of conditions and the following disclaimer.--- 2. Redistributions in binary form must reproduce the above copyright--- notice, this list of conditions and the following disclaimer in the--- documentation and/or other materials provided with the distribution.--- 3. Neither the name of the University nor the names of its contributors--- may be used to endorse or promote products derived from this software--- without specific prior written permission.---- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND--- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE--- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE--- ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE--- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT--- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY--- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF--- SUCH DAMAGE.---------------------------------------------------------------------------------- -- | -- Module : Text.PrettyPrint.Mainland--- Copyright : (c) Harvard University 2006-2012+-- Copyright : (c) Harvard University 2006-2011+-- (c) Geoffrey Mainland 2011-2012 -- License : BSD-style -- Maintainer : mainland@eecs.harvard.edu --@@ -46,7 +19,6 @@ -- that handles precedence and the ability to automatically track the source -- locations associated with pretty printed values and output appropriate -- #line pragmas.--------------------------------------------------------------------------------- {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-}@@ -91,6 +63,9 @@ displayLazyText, prettyLazyText, displayPragmaLazyText, prettyPragmaLazyText, + -- * Document output+ putDoc, hPutDoc,+ -- * The 'Pretty' type class for pretty printing Pretty(..), @@ -108,10 +83,12 @@ import Data.Monoid import qualified Data.Set as Set import qualified Data.Text as T+import qualified Data.Text.Lazy.IO as TIO import qualified Data.Text.Lazy as L import qualified Data.Text.Lazy.Builder as B import Data.Word import GHC.Real (Ratio(..))+import System.IO (Handle) infixr 5 </>, <+/>, <//> infixr 6 <+>@@ -641,6 +618,14 @@ fits !w (RLazyText s x) = fits (w - fromIntegral (L.length s)) x fits !w (RPos _ x) = fits w x fits !_ (RLine _ _) = True++-- | Render a document with a width of 80 and print it to standard output.+putDoc :: Doc -> IO ()+putDoc = TIO.putStr . prettyLazyText 80++-- | Render a document with a width of 80 and print it to the specified handle.+hPutDoc :: Handle -> Doc -> IO ()+hPutDoc h = TIO.hPutStr h . prettyLazyText 80 #if !MIN_VERSION_base(4,5,0) infixr 6 <>
mainland-pretty.cabal view
@@ -1,9 +1,10 @@ name: mainland-pretty-version: 0.2.2+version: 0.2.3 cabal-version: >= 1.6 license: BSD3 license-file: LICENSE-copyright: (c) 2006-2012 Harvard University+copyright: (c) 2006-2011 Harvard University+ (c) 2011-2012 Geoffrey Mainland author: Geoffrey Mainland <mainland@eecs.harvard.edu> maintainer: mainland@eecs.harvard.edu stability: alpha@@ -24,10 +25,10 @@ Text.PrettyPrint.Mainland build-depends:- base >= 4 && < 5,- containers >= 0.2 && < 0.5,- srcloc == 0.2.*,- text >0.11 && <0.12+ base >= 4 && < 5,+ containers >= 0.2 && < 0.6,+ srcloc >= 0.3 && < 0.4,+ text > 0.11 && < 0.12 source-repository head type: git