Skip to content

Commit

Permalink
Merge pull request #6253 from commercialhaskell/rpp
Browse files Browse the repository at this point in the history
Depend on rio-prettyprint-0.1.7.0
  • Loading branch information
mpilgrem authored Sep 23, 2023
2 parents 88b4c2f + b4f7325 commit 93da0ca
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 42 deletions.
2 changes: 1 addition & 1 deletion cabal.config
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ constraints:
, retry ==0.9.3.1
, rio ==0.1.22.0
, rio-orphans ==0.1.2.0
, rio-prettyprint ==0.1.5.0
, rio-prettyprint ==0.1.7.0
, rts ==1.0.2
, safe ==0.3.19
, safe-exceptions ==0.1.7.4
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ dependencies:
- project-template
- random
- rio >= 0.1.22.0
- rio-prettyprint >= 0.1.5.0
- rio-prettyprint >= 0.1.7.0
- split
- stm
- tar
Expand Down
47 changes: 12 additions & 35 deletions src/Stack/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,21 @@ import RIO as X
import RIO.File as X hiding ( writeBinaryFileAtomic )
import RIO.PrettyPrint
( HasStylesUpdate (..), HasTerm (..), Pretty (..), Style (..)
, StyleDoc, (<+>), align, bulletedList, debugBracket
, displayWithColor, encloseSep, fill, fillSep, flow, hang
, hcat, hsep, indent, line, logLevelToStyle, mkNarrativeList
, StyleDoc, (<+>), align, blankLine, bulletedList
, debugBracket, encloseSep, fill, fillSep, flow, hang, hcat
, hsep, indent, line, logLevelToStyle, mkNarrativeList
, parens, prettyDebug, prettyDebugL, prettyError
, prettyErrorL, prettyInfo, prettyInfoL, prettyInfoS
, prettyNote, prettyNoteL, prettyNoteS, prettyWarn
, prettyWarnL, prettyWarnNoIndent, prettyWarnS, punctuate
, sep, softbreak, softline, spacedBulletedList, string, style
, stylesUpdateL, useColorL, vsep, spacedBulletedList
, prettyErrorL, prettyGeneric, prettyInfo, prettyInfoL
, prettyInfoS, prettyNote, prettyNoteL, prettyNoteS
, prettyWarn, prettyWarnL, prettyWarnNoIndent, prettyWarnS
, punctuate, sep, softbreak, softline, spacedBulletedList
, string, style, stylesUpdateL, useColorL, vsep
)
import RIO.PrettyPrint.DefaultStyles (defaultStyles)
import RIO.PrettyPrint.PrettyException ( PrettyException (..) )
import RIO.PrettyPrint.PrettyException
( PrettyException (..), ppException, prettyThrowIO
, prettyThrowM
)
import RIO.PrettyPrint.StylesUpdate
( StylesUpdate (..), parseStylesUpdateFromString )
import RIO.PrettyPrint.Types ( StyleSpec )
Expand Down Expand Up @@ -344,32 +347,6 @@ bugDeclaration = "The impossible happened!"
bugRequest :: String
bugRequest = "Please report this bug at Stack's repository."

-- | A \'pretty\' blank line.
blankLine :: StyleDoc
blankLine = line <> line

-- | Provide the prettiest available information about an exception.
ppException :: SomeException -> StyleDoc
ppException e = case fromException e of
Just (PrettyException e') -> pretty e'
Nothing -> (string . displayException) e

-- | Synchronously throw the given exception as a 'PrettyException'.
prettyThrowIO :: (Exception e, MonadIO m, Pretty e) => e -> m a
prettyThrowIO = throwIO . PrettyException

-- | Throw the given exception as a 'PrettyException', when the action is run in
-- the monad @m@.
prettyThrowM :: (Exception e, MonadThrow m, Pretty e) => e -> m a
prettyThrowM = throwM . PrettyException

-- | Maybe cons.
mcons :: Maybe a -> [a] -> [a]
mcons ma as = maybe as (:as) ma

prettyGeneric ::
(HasTerm env, HasCallStack, Pretty b, MonadReader env m, MonadIO m)
=> LogLevel
-> b
-> m ()
prettyGeneric level = logGeneric "" level . display <=< displayWithColor
3 changes: 3 additions & 0 deletions stack-ghc-9.6.2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# GHC 9.6.2
resolver: nightly-2023-09-16

extra-deps:
- rio-prettyprint-0.1.7.0@sha256:4f0f2dabcbc3be1f9871de7c2ff3d090b82462ca5924afa24f7b2540c5511d84,1428

docker:
enable: false
repo: glcr.b-data.ch/ghc/ghc-musl:9.6.2
Expand Down
9 changes: 8 additions & 1 deletion stack-ghc-9.6.2.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages: []
packages:
- completed:
hackage: rio-prettyprint-0.1.7.0@sha256:4f0f2dabcbc3be1f9871de7c2ff3d090b82462ca5924afa24f7b2540c5511d84,1428
pantry-tree:
sha256: 5d18c4b8e4a0a959ab3e8544ea1baae1674ebbe01f379a2a75215c05f7d255ee
size: 779
original:
hackage: rio-prettyprint-0.1.7.0@sha256:4f0f2dabcbc3be1f9871de7c2ff3d090b82462ca5924afa24f7b2540c5511d84,1428
snapshots:
- completed:
sha256: a25fd287afcd300f35a2019a03c990169f7507ae0f43dfec763062c9ad891193
Expand Down
8 changes: 4 additions & 4 deletions stack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ library
, project-template
, random
, rio >=0.1.22.0
, rio-prettyprint >=0.1.5.0
, rio-prettyprint >=0.1.7.0
, split
, stm
, tar
Expand Down Expand Up @@ -501,7 +501,7 @@ executable stack
, project-template
, random
, rio >=0.1.22.0
, rio-prettyprint >=0.1.5.0
, rio-prettyprint >=0.1.7.0
, split
, stack
, stm
Expand Down Expand Up @@ -600,7 +600,7 @@ executable stack-integration-test
, project-template
, random
, rio >=0.1.22.0
, rio-prettyprint >=0.1.5.0
, rio-prettyprint >=0.1.7.0
, split
, stm
, tar
Expand Down Expand Up @@ -713,7 +713,7 @@ test-suite stack-unit-test
, random
, raw-strings-qq
, rio >=0.1.22.0
, rio-prettyprint >=0.1.5.0
, rio-prettyprint >=0.1.7.0
, split
, stack
, stm
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extra-deps:
- optparse-applicative-0.18.1.0@sha256:b4cf8d9018e5e67cb1f14edb5130b6d05ad8bc1b5f6bd4efaa6ec0b7f28f559d,5132
- optparse-generic-1.5.1@sha256:c65a7d3429feedf870f5a9f7f0d2aaf75609888b52449f85f22871b5f5a7e95f,2204
- pantry-0.9.2@sha256:e1c5444d1b4003435d860853abd21e91e5fc337f2b2e2c8c992a2bac04712dc0,7650
- rio-prettyprint-0.1.7.0@sha256:4f0f2dabcbc3be1f9871de7c2ff3d090b82462ca5924afa24f7b2540c5511d84,1428
- static-bytes-0.1.0@sha256:35dbf30f617baa0151682c97687042516be07872a39984f9fe31f78125b962bf,1627
- tar-conduit-0.4.0@sha256:f333649770f5ec42a83a93b0d424cf6bb895d80dfbee05a54340395f81d036ae,3126
- tls-1.9.0@sha256:8ad332dc0224decb1b137bf6c9678b4f786487b9aaa5c9068cd3ad19d42c39a7,5571
Expand Down
7 changes: 7 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ packages:
size: 2665
original:
hackage: pantry-0.9.2@sha256:e1c5444d1b4003435d860853abd21e91e5fc337f2b2e2c8c992a2bac04712dc0,7650
- completed:
hackage: rio-prettyprint-0.1.7.0@sha256:4f0f2dabcbc3be1f9871de7c2ff3d090b82462ca5924afa24f7b2540c5511d84,1428
pantry-tree:
sha256: 5d18c4b8e4a0a959ab3e8544ea1baae1674ebbe01f379a2a75215c05f7d255ee
size: 779
original:
hackage: rio-prettyprint-0.1.7.0@sha256:4f0f2dabcbc3be1f9871de7c2ff3d090b82462ca5924afa24f7b2540c5511d84,1428
- completed:
hackage: static-bytes-0.1.0@sha256:35dbf30f617baa0151682c97687042516be07872a39984f9fe31f78125b962bf,1627
pantry-tree:
Expand Down

0 comments on commit 93da0ca

Please sign in to comment.