1 -- | A small prelude used in @zinza@ generated
3 module Distribution
.ZinzaPrelude
16 import Distribution
.Compat
.Prelude
19 import Control
.Monad
(forM_
)
20 import Distribution
.Pretty
(prettyShow
)
21 import Distribution
.Types
.PackageName
(PackageName
)
22 import Distribution
.Types
.Version
(Version
)
24 newtype Writer a
= W
{unW
:: ShowS -> (ShowS, a
)}
26 instance Functor Writer
where
29 instance Applicative Writer
where
30 pure x
= W
$ \ss
-> (ss
, x
)
33 instance Monad Writer
where
36 let (s2
, x
) = unW m s1
40 execWriter
:: Writer a
-> String
41 execWriter w
= fst (unW w
id) ""
43 tell
:: String -> Writer
()
44 tell s
= W
$ \s
' -> (s
' . showString s
, ())