Skip to content

Commit

Permalink
Merge pull request #25 from commercialhaskell/pretty
Browse files Browse the repository at this point in the history
Add Arch and OS instances of Pretty
  • Loading branch information
mpilgrem authored Dec 24, 2023
2 parents 8cf8be8 + 2c571c4 commit 25e96c4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
8 changes: 6 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for rio-prettyprint

## 0.1.8.0

* Add `Arch` and `OS` instances of `Pretty`.

## 0.1.7.0

* Add `prettyThrowIO` and `prettyThrowM`, to throw an exception as a
Expand All @@ -17,12 +21,12 @@

## 0.1.5.0

* Add `Pretty` instances for `SomeBase Dir` and `SomeBase File`.
* Add `SomeBase Dir` and `SomeBase File` instances of `Pretty`.

## 0.1.4.0

* Add `string` and `mkNarrativeList`.
* The `Show` instance of `PrettyException` is now derived. `displayException` is
* The `PrettyException` instance of `Show` is now derived. `displayException` is
now defined, as the `displayException` of the inner exception.

## 0.1.3.0
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: rio-prettyprint
version: 0.1.7.0
version: 0.1.8.0
synopsis: Pretty-printing for RIO
description: Combine RIO's log capabilities with pretty printing
category: Development
Expand Down
4 changes: 2 additions & 2 deletions rio-prettyprint.cabal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.5.
-- This file has been generated from package.yaml by hpack version 0.36.0.
--
-- see: https://github.com/sol/hpack

name: rio-prettyprint
version: 0.1.7.0
version: 0.1.8.0
synopsis: Pretty-printing for RIO
description: Combine RIO's log capabilities with pretty printing
category: Development
Expand Down
12 changes: 11 additions & 1 deletion src/Text/PrettyPrint/Leijen/Extended.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Text.PrettyPrint.Leijen.Extended

-- * Documents annotated by a style
, StyleDoc (..)
, StyleAnn(..)
, StyleAnn (..)
, displayAnsi
, displayPlain
, renderDefault
Expand Down Expand Up @@ -156,7 +156,9 @@ import Control.Monad.Reader ( local, runReader )
import Data.Array.IArray ( (!), (//) )
import qualified Data.Text as T
import Distribution.ModuleName ( ModuleName )
import Distribution.System ( Arch (..), OS (..) )
import qualified Distribution.Text ( display )
import Distribution.Utils.Generic ( lowercase )
import Path ( Dir, File, Path, SomeBase, prjSomeBase, toFilePath )
import RIO
import qualified RIO.Map as M
Expand Down Expand Up @@ -209,6 +211,14 @@ instance Pretty (SomeBase Dir) where
instance Pretty ModuleName where
pretty = StyleDoc . fromString . Distribution.Text.display

instance Pretty Arch where
pretty (OtherArch name) = fromString name
pretty other = fromString $ lowercase $ show other

instance Pretty OS where
pretty (OtherOS name) = fromString name
pretty other = fromString $ lowercase $ show other

--------------------------------------------------------------------------------
-- Style Doc

Expand Down

0 comments on commit 25e96c4

Please sign in to comment.