chatty 0.8.0.0 → 0.8.0.1
raw patch · 16 files changed
+129/−251 lines, 16 filesdep +resourcetdep −directorydep −processdep −randomdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: resourcet
Dependencies removed: directory, process, random, setenv, time, unix
Dependency ranges changed: base
API changes (from Hackage documentation)
- Text.Chatty.Finalizer: HandleCloser :: ([Handle] -> m (a, [Handle])) -> HandleCloserT m a
- Text.Chatty.Finalizer: [runHandleCloserT] :: HandleCloserT m a -> [Handle] -> m (a, [Handle])
- Text.Chatty.Finalizer: class Monad m => ChFinalizer m
- Text.Chatty.Finalizer: instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Finalizer: instance Control.Monad.IO.Class.MonadIO m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Finalizer: instance Control.Monad.Trans.Class.MonadTrans Text.Chatty.Finalizer.HandleCloserT
- Text.Chatty.Finalizer: instance GHC.Base.Monad m => GHC.Base.Applicative (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Finalizer: instance GHC.Base.Monad m => GHC.Base.Functor (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Finalizer: instance GHC.Base.Monad m => GHC.Base.Monad (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Finalizer: mfin :: ChFinalizer m => m ()
- Text.Chatty.Finalizer: mqfh :: ChFinalizer m => Handle -> m ()
- Text.Chatty.Finalizer: mqfhs :: ChFinalizer m => [Handle] -> m ()
- Text.Chatty.Finalizer: newtype HandleCloserT m a
- Text.Chatty.Finalizer: withLazyIO :: (MonadIO m, Functor m) => HandleCloserT m a -> m a
- Text.Chatty.Interactor: instance Data.Chatty.Atoms.ChAtoms m => Data.Chatty.Atoms.ChAtoms (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Data.Chatty.Atoms.ChAtoms m => Data.Chatty.Atoms.ChAtoms (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Data.Chatty.Counter.ChCounter m => Data.Chatty.Counter.ChCounter (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Data.Chatty.Counter.ChCounter m => Data.Chatty.Counter.ChCounter (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Text.Chatty.Channel.Printer.ChChannelPrinter GHC.IO.Handle.Types.Handle m => Text.Chatty.Channel.Printer.ChChannelPrinter GHC.IO.Handle.Types.Handle (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Channel.Printer.ChChannelPrinter GHC.Types.Bool m => Text.Chatty.Channel.Printer.ChChannelPrinter GHC.Types.Bool (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Channel.Printer.ChChannelPrinter GHC.Types.Int m => Text.Chatty.Channel.Printer.ChChannelPrinter GHC.Types.Int (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Expansion.ChExpand m => Text.Chatty.Expansion.ChExpand (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Expansion.ChExpand m => Text.Chatty.Expansion.ChExpand (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Text.Chatty.Expansion.History.ChHistoryEnv m => Text.Chatty.Expansion.History.ChHistoryEnv (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Expansion.History.ChHistoryEnv m => Text.Chatty.Expansion.History.ChHistoryEnv (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Text.Chatty.Expansion.Vars.ChExpanderEnv m => Text.Chatty.Expansion.Vars.ChExpanderEnv (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Expansion.Vars.ChExpanderEnv m => Text.Chatty.Expansion.Vars.ChExpanderEnv (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Data.Chatty.Atoms.AtomStoreT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Data.Chatty.Counter.CounterT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.BoolArchiverT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.BoolFilterT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.HandleArchiverT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.HandleFilterT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.IntArchiverT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.IntFilterT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Channel.Printer.JoinerT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Expansion.History.HistoryT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Expansion.NullExpanderT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Expansion.Vars.ExpanderT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Extended.ANSI.AnsiPrinterT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Extended.HTML.HtmlPrinterT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Printer.OutRedirT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Printer.RecorderT m)
- Text.Chatty.Interactor: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Scanner.Buffered.ScannerBufferT m)
- Text.Chatty.Interactor: instance Text.Chatty.Printer.ChPrinter m => Text.Chatty.Printer.ChPrinter (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Scanner.Buffered.ChBufferedScanner m => Text.Chatty.Scanner.Buffered.ChBufferedScanner (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Scanner.Buffered.ChBufferedScanner m => Text.Chatty.Scanner.Buffered.ChBufferedScanner (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor: instance Text.Chatty.Scanner.ChScanner m => Text.Chatty.Scanner.ChScanner (Text.Chatty.Finalizer.HandleCloserT m)
- Text.Chatty.Interactor: instance Text.Chatty.Scanner.ChScanner m => Text.Chatty.Scanner.ChScanner (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Interactor.Templates: mkFinalizer :: Name -> Q [Dec]
- Text.Chatty.Printer: Deaf :: m a -> DeafT m a
- Text.Chatty.Printer: [runDeafT] :: DeafT m a -> m a
- Text.Chatty.Printer: instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Printer: instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Printer: instance Control.Monad.Trans.Class.MonadTrans Text.Chatty.Printer.DeafT
- Text.Chatty.Printer: instance GHC.Base.Functor m => GHC.Base.Functor (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Printer: instance GHC.Base.Monad m => GHC.Base.Monad (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Printer: instance GHC.Base.Monad m => Text.Chatty.Printer.ChPrinter (Text.Chatty.Printer.DeafT m)
- Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget GHC.IO.FilePath Text.Chatty.Printer.OutRedirT a a
- Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget GHC.IO.Handle.Types.Handle Text.Chatty.Printer.OutRedirT a a
- Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget Text.Chatty.Printer.DiscardO Text.Chatty.Printer.DeafT a a
- Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget Text.Chatty.Printer.RecordO Text.Chatty.Printer.RecorderT a (a, Text.Chatty.Printer.Replayable)
- Text.Chatty.Printer: newtype DeafT m a
- Text.Chatty.Printer: runOutRedirF :: OutRedir a -> FilePath -> IOMode -> IO a
- Text.Chatty.Scanner: instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Text.Chatty.Scanner.QuietT m)
- Text.Chatty.Scanner: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Scanner.HereStringT m)
- Text.Chatty.Scanner: instance Text.Chatty.Finalizer.ChFinalizer m => Text.Chatty.Finalizer.ChFinalizer (Text.Chatty.Scanner.InRedirT m)
- Text.Chatty.Scanner: instance Text.Chatty.Scanner.RedirectionSource GHC.IO.FilePath Text.Chatty.Scanner.InRedirT a a
- Text.Chatty.Scanner: instance Text.Chatty.Scanner.RedirectionSource GHC.IO.Handle.Types.Handle Text.Chatty.Scanner.InRedirT a a
- Text.Chatty.Scanner: instance Text.Chatty.Scanner.RedirectionSource Text.Chatty.Scanner.EmptyI Text.Chatty.Scanner.QuietT a a
- Text.Chatty.Scanner: runInRedirF :: InRedir a -> FilePath -> IO a
+ Text.Chatty.Interactor: instance Data.Chatty.Atoms.ChAtoms m => Data.Chatty.Atoms.ChAtoms (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Interactor: instance Data.Chatty.Counter.ChCounter m => Data.Chatty.Counter.ChCounter (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Interactor: instance Text.Chatty.Expansion.ChExpand m => Text.Chatty.Expansion.ChExpand (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Interactor: instance Text.Chatty.Expansion.History.ChHistoryEnv m => Text.Chatty.Expansion.History.ChHistoryEnv (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Interactor: instance Text.Chatty.Expansion.Vars.ChExpanderEnv m => Text.Chatty.Expansion.Vars.ChExpanderEnv (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Interactor: instance Text.Chatty.Scanner.Buffered.ChBufferedScanner m => Text.Chatty.Scanner.Buffered.ChBufferedScanner (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Interactor: instance Text.Chatty.Scanner.ChScanner m => Text.Chatty.Scanner.ChScanner (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Printer: Discard :: m a -> DiscardT (m :: Type -> Type) a
+ Text.Chatty.Printer: [runDiscardT] :: DiscardT (m :: Type -> Type) a -> m a
+ Text.Chatty.Printer: instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Printer: instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Printer: instance Control.Monad.Trans.Class.MonadTrans Text.Chatty.Printer.DiscardT
+ Text.Chatty.Printer: instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Text.Chatty.Printer.OutRedirT m)
+ Text.Chatty.Printer: instance GHC.Base.Functor m => GHC.Base.Functor (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Printer: instance GHC.Base.Monad m => GHC.Base.Monad (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Printer: instance GHC.Base.Monad m => Text.Chatty.Printer.ChPrinter (Text.Chatty.Printer.DiscardT m)
+ Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget GHC.IO.FilePath Control.Monad.Trans.Resource.Internal.MonadResource Text.Chatty.Printer.OutRedirT a a
+ Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget GHC.IO.Handle.Types.Handle Control.Monad.IO.Class.MonadIO Text.Chatty.Printer.OutRedirT a a
+ Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget Text.Chatty.Printer.DiscardO GHC.Base.Monad Text.Chatty.Printer.DiscardT a a
+ Text.Chatty.Printer: instance Text.Chatty.Printer.RedirectionTarget Text.Chatty.Printer.RecordO GHC.Base.Monad Text.Chatty.Printer.RecorderT a (a, Text.Chatty.Printer.Replayable)
+ Text.Chatty.Printer: newtype DiscardT (m :: Type -> Type) a
+ Text.Chatty.Scanner: instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Text.Chatty.Scanner.HereStringT m)
+ Text.Chatty.Scanner: instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Text.Chatty.Scanner.InRedirT m)
+ Text.Chatty.Scanner: instance GHC.Base.Monad m => GHC.Base.Applicative (Text.Chatty.Scanner.QuietT m)
+ Text.Chatty.Scanner: instance Text.Chatty.Scanner.RedirectionSource GHC.IO.FilePath Control.Monad.Trans.Resource.Internal.MonadResource Text.Chatty.Scanner.InRedirT a a
+ Text.Chatty.Scanner: instance Text.Chatty.Scanner.RedirectionSource GHC.IO.Handle.Types.Handle Control.Monad.IO.Class.MonadIO Text.Chatty.Scanner.InRedirT a a
+ Text.Chatty.Scanner: instance Text.Chatty.Scanner.RedirectionSource Text.Chatty.Scanner.EmptyI GHC.Base.Monad Text.Chatty.Scanner.QuietT a a
- Text.Chatty.Channel.Broadcast: class ChChannelPrinter c m => ChBroadcaster c m
+ Text.Chatty.Channel.Broadcast: class ChChannelPrinter c m => ChBroadcaster c (m :: Type -> Type)
- Text.Chatty.Channel.Broadcast: class ChBroadcaster c m => ChBroadcasterBracket c m
+ Text.Chatty.Channel.Broadcast: class ChBroadcaster c m => ChBroadcasterBracket c (m :: Type -> Type)
- Text.Chatty.Channel.Printer: Archiver :: (([(c, [String])], [c]) -> m (a, ([(c, [String])], [c]))) -> ArchiverT c m a
+ Text.Chatty.Channel.Printer: Archiver :: (([(c, [String])], [c]) -> m (a, ([(c, [String])], [c]))) -> ArchiverT c (m :: Type -> Type) a
- Text.Chatty.Channel.Printer: Filter :: ((c, [c]) -> m (a, [c])) -> FilterT c m a
+ Text.Chatty.Channel.Printer: Filter :: ((c, [c]) -> m (a, [c])) -> FilterT c (m :: Type -> Type) a
- Text.Chatty.Channel.Printer: Joiner :: m a -> JoinerT m a
+ Text.Chatty.Channel.Printer: Joiner :: m a -> JoinerT (m :: Type -> Type) a
- Text.Chatty.Channel.Printer: [runArchiverT'] :: ArchiverT c m a -> ([(c, [String])], [c]) -> m (a, ([(c, [String])], [c]))
+ Text.Chatty.Channel.Printer: [runArchiverT'] :: ArchiverT c (m :: Type -> Type) a -> ([(c, [String])], [c]) -> m (a, ([(c, [String])], [c]))
- Text.Chatty.Channel.Printer: [runFilterT] :: FilterT c m a -> (c, [c]) -> m (a, [c])
+ Text.Chatty.Channel.Printer: [runFilterT] :: FilterT c (m :: Type -> Type) a -> (c, [c]) -> m (a, [c])
- Text.Chatty.Channel.Printer: [runJoinerT] :: JoinerT m a -> m a
+ Text.Chatty.Channel.Printer: [runJoinerT] :: JoinerT (m :: Type -> Type) a -> m a
- Text.Chatty.Channel.Printer: class (ChPrinter m, Eq c) => ChChannelPrinter c m
+ Text.Chatty.Channel.Printer: class (ChPrinter m, Eq c) => ChChannelPrinter c (m :: Type -> Type)
- Text.Chatty.Channel.Printer: newtype ArchiverT c m a
+ Text.Chatty.Channel.Printer: newtype ArchiverT c (m :: Type -> Type) a
- Text.Chatty.Channel.Printer: newtype FilterT c m a
+ Text.Chatty.Channel.Printer: newtype FilterT c (m :: Type -> Type) a
- Text.Chatty.Channel.Printer: newtype JoinerT m a
+ Text.Chatty.Channel.Printer: newtype JoinerT (m :: Type -> Type) a
- Text.Chatty.Expansion: NullExpander :: m a -> NullExpanderT m a
+ Text.Chatty.Expansion: NullExpander :: m a -> NullExpanderT (m :: Type -> Type) a
- Text.Chatty.Expansion: [runNullExpanderT] :: NullExpanderT m a -> m a
+ Text.Chatty.Expansion: [runNullExpanderT] :: NullExpanderT (m :: Type -> Type) a -> m a
- Text.Chatty.Expansion: class Monad e => ChExpand e
+ Text.Chatty.Expansion: class Monad e => ChExpand (e :: Type -> Type)
- Text.Chatty.Expansion: newtype NullExpanderT m a
+ Text.Chatty.Expansion: newtype NullExpanderT (m :: Type -> Type) a
- Text.Chatty.Expansion.History: History :: ([String] -> m (a, [String])) -> HistoryT m a
+ Text.Chatty.Expansion.History: History :: ([String] -> m (a, [String])) -> HistoryT (m :: Type -> Type) a
- Text.Chatty.Expansion.History: [runHistoryT] :: HistoryT m a -> [String] -> m (a, [String])
+ Text.Chatty.Expansion.History: [runHistoryT] :: HistoryT (m :: Type -> Type) a -> [String] -> m (a, [String])
- Text.Chatty.Expansion.History: class Monad he => ChHistoryEnv he
+ Text.Chatty.Expansion.History: class Monad he => ChHistoryEnv (he :: Type -> Type)
- Text.Chatty.Expansion.History: newtype HistoryT m a
+ Text.Chatty.Expansion.History: newtype HistoryT (m :: Type -> Type) a
- Text.Chatty.Expansion.Vars: Expander :: ([(String, EnvVar)] -> m (a, [(String, EnvVar)])) -> ExpanderT m a
+ Text.Chatty.Expansion.Vars: Expander :: ([(String, EnvVar)] -> m (a, [(String, EnvVar)])) -> ExpanderT (m :: Type -> Type) a
- Text.Chatty.Expansion.Vars: [runExpanderT] :: ExpanderT m a -> [(String, EnvVar)] -> m (a, [(String, EnvVar)])
+ Text.Chatty.Expansion.Vars: [runExpanderT] :: ExpanderT (m :: Type -> Type) a -> [(String, EnvVar)] -> m (a, [(String, EnvVar)])
- Text.Chatty.Expansion.Vars: class Monad ee => ChExpanderEnv ee
+ Text.Chatty.Expansion.Vars: class Monad ee => ChExpanderEnv (ee :: Type -> Type)
- Text.Chatty.Expansion.Vars: exportAll :: (Monad m, MonadIO m) => ExpanderT m ()
+ Text.Chatty.Expansion.Vars: exportAll :: forall (m :: Type -> Type). (Monad m, MonadIO m) => ExpanderT m ()
- Text.Chatty.Expansion.Vars: newtype ExpanderT m a
+ Text.Chatty.Expansion.Vars: newtype ExpanderT (m :: Type -> Type) a
- Text.Chatty.Extended.ANSI: AnsiPrinter :: ([Colour] -> m (a, [Colour])) -> AnsiPrinterT m a
+ Text.Chatty.Extended.ANSI: AnsiPrinter :: ([Colour] -> m (a, [Colour])) -> AnsiPrinterT (m :: Type -> Type) a
- Text.Chatty.Extended.ANSI: [runAnsiPrinterT] :: AnsiPrinterT m a -> [Colour] -> m (a, [Colour])
+ Text.Chatty.Extended.ANSI: [runAnsiPrinterT] :: AnsiPrinterT (m :: Type -> Type) a -> [Colour] -> m (a, [Colour])
- Text.Chatty.Extended.ANSI: newtype AnsiPrinterT m a
+ Text.Chatty.Extended.ANSI: newtype AnsiPrinterT (m :: Type -> Type) a
- Text.Chatty.Extended.HTML: HtmlPrinter :: m a -> HtmlPrinterT m a
+ Text.Chatty.Extended.HTML: HtmlPrinter :: m a -> HtmlPrinterT (m :: Type -> Type) a
- Text.Chatty.Extended.HTML: [runHtmlPrinterT] :: HtmlPrinterT m a -> m a
+ Text.Chatty.Extended.HTML: [runHtmlPrinterT] :: HtmlPrinterT (m :: Type -> Type) a -> m a
- Text.Chatty.Extended.HTML: hexColour :: Colour -> [Char]
+ Text.Chatty.Extended.HTML: hexColour :: Colour -> String
- Text.Chatty.Extended.HTML: newtype HtmlPrinterT m a
+ Text.Chatty.Extended.HTML: newtype HtmlPrinterT (m :: Type -> Type) a
- Text.Chatty.Extended.Printer: class ChPrinter m => ChExtendedPrinter m
+ Text.Chatty.Extended.Printer: class ChPrinter m => ChExtendedPrinter (m :: Type -> Type)
- Text.Chatty.Interactor: (.<$.) :: (Functor m, Monad m) => (String -> m b) -> RecorderT m a -> m b
+ Text.Chatty.Interactor: (.<$.) :: Monad m => (String -> m b) -> RecorderT m a -> m b
- Text.Chatty.Interactor: (.|.) :: (Monad m, Functor m) => RecorderT m a -> HereStringT m b -> m b
+ Text.Chatty.Interactor: (.|.) :: Monad m => RecorderT m a -> HereStringT m b -> m b
- Text.Chatty.Interactor: runChattyT :: (Monad m, Functor m) => ChattyT m a -> String -> m (a, String, Replayable)
+ Text.Chatty.Interactor: runChattyT :: Monad m => ChattyT m a -> String -> m (a, String, Replayable)
- Text.Chatty.Interactor: type ChattyT m = HereStringT (RecorderT m)
+ Text.Chatty.Interactor: type ChattyT (m :: Type -> Type) = HereStringT RecorderT m
- Text.Chatty.Interactor: type IgnorantT m = QuietT (DeafT m)
+ Text.Chatty.Interactor: type IgnorantT (m :: Type -> Type) = QuietT DiscardT m
- Text.Chatty.Printer: (.>.) :: (RedirectionTarget t mt a r, Functor m, MonadIO m, ChPrinter (mt m)) => mt m a -> t -> m r
+ Text.Chatty.Printer: (.>.) :: (RedirectionTarget t c mt a r, c m, ChPrinter (mt m)) => mt m a -> t -> m r
- Text.Chatty.Printer: (.>>.) :: (RedirectionTarget t mt a r, Functor m, MonadIO m, ChPrinter (mt m)) => mt m a -> t -> m r
+ Text.Chatty.Printer: (.>>.) :: (RedirectionTarget t c mt a r, c m, ChPrinter (mt m)) => mt m a -> t -> m r
- Text.Chatty.Printer: OutRedir :: (Handle -> m a) -> OutRedirT m a
+ Text.Chatty.Printer: OutRedir :: (Handle -> m a) -> OutRedirT (m :: Type -> Type) a
- Text.Chatty.Printer: Recorder :: m (a, [String]) -> RecorderT m a
+ Text.Chatty.Printer: Recorder :: m (a, [String]) -> RecorderT (m :: Type -> Type) a
- Text.Chatty.Printer: [runOutRedirT] :: OutRedirT m a -> Handle -> m a
+ Text.Chatty.Printer: [runOutRedirT] :: OutRedirT (m :: Type -> Type) a -> Handle -> m a
- Text.Chatty.Printer: [runRecorderT'] :: RecorderT m a -> m (a, [String])
+ Text.Chatty.Printer: [runRecorderT'] :: RecorderT (m :: Type -> Type) a -> m (a, [String])
- Text.Chatty.Printer: class Monad m => ChPrinter m
+ Text.Chatty.Printer: class Monad m => ChPrinter (m :: Type -> Type)
- Text.Chatty.Printer: class RedirectionTarget t mt a r | t -> mt, t a -> r
+ Text.Chatty.Printer: class RedirectionTarget t (c :: Type -> Type -> Constraint) (mt :: Type -> Type -> Type -> Type) a r | t -> mt c, t a -> r
- Text.Chatty.Printer: newtype OutRedirT m a
+ Text.Chatty.Printer: newtype OutRedirT (m :: Type -> Type) a
- Text.Chatty.Printer: newtype RecorderT m a
+ Text.Chatty.Printer: newtype RecorderT (m :: Type -> Type) a
- Text.Chatty.Printer: runOutRedirFT :: (Functor m, MonadIO m) => OutRedirT m a -> FilePath -> IOMode -> m a
+ Text.Chatty.Printer: runOutRedirFT :: MonadResource m => OutRedirT m a -> FilePath -> IOMode -> m a
- Text.Chatty.Printer: runRecorderT :: (Functor m, Monad m) => RecorderT m a -> m (a, Replayable)
+ Text.Chatty.Printer: runRecorderT :: Monad m => RecorderT m a -> m (a, Replayable)
- Text.Chatty.Scanner: (.<.) :: (RedirectionSource t mt a r, ChFinalizer m, Functor m, MonadIO m, ChScanner (mt m)) => mt m a -> t -> m r
+ Text.Chatty.Scanner: (.<.) :: (RedirectionSource t c mt a r, c m, ChScanner (mt m)) => mt m a -> t -> m r
- Text.Chatty.Scanner: HereString :: (String -> m (a, String)) -> HereStringT m a
+ Text.Chatty.Scanner: HereString :: (String -> m (a, String)) -> HereStringT (m :: Type -> Type) a
- Text.Chatty.Scanner: InRedir :: (Handle -> m a) -> InRedirT m a
+ Text.Chatty.Scanner: InRedir :: (Handle -> m a) -> InRedirT (m :: Type -> Type) a
- Text.Chatty.Scanner: Quiet :: m a -> QuietT m a
+ Text.Chatty.Scanner: Quiet :: m a -> QuietT (m :: Type -> Type) a
- Text.Chatty.Scanner: [runHereStringT] :: HereStringT m a -> String -> m (a, String)
+ Text.Chatty.Scanner: [runHereStringT] :: HereStringT (m :: Type -> Type) a -> String -> m (a, String)
- Text.Chatty.Scanner: [runInRedirT] :: InRedirT m a -> Handle -> m a
+ Text.Chatty.Scanner: [runInRedirT] :: InRedirT (m :: Type -> Type) a -> Handle -> m a
- Text.Chatty.Scanner: [runQuietT] :: QuietT m a -> m a
+ Text.Chatty.Scanner: [runQuietT] :: QuietT (m :: Type -> Type) a -> m a
- Text.Chatty.Scanner: class Monad m => ChScanner m
+ Text.Chatty.Scanner: class Monad m => ChScanner (m :: Type -> Type)
- Text.Chatty.Scanner: class RedirectionHeredoc t mt a r | t -> mt, t a -> r
+ Text.Chatty.Scanner: class RedirectionHeredoc t (mt :: Type -> Type -> Type -> Type) a r | t -> mt, t a -> r
- Text.Chatty.Scanner: class RedirectionSource t mt a r | t -> mt, t a -> r
+ Text.Chatty.Scanner: class RedirectionSource t (c :: Type -> Type -> Constraint) (mt :: Type -> Type -> Type -> Type) a r | t -> mt c, t a -> r
- Text.Chatty.Scanner: newtype HereStringT m a
+ Text.Chatty.Scanner: newtype HereStringT (m :: Type -> Type) a
- Text.Chatty.Scanner: newtype InRedirT m a
+ Text.Chatty.Scanner: newtype InRedirT (m :: Type -> Type) a
- Text.Chatty.Scanner: newtype QuietT m a
+ Text.Chatty.Scanner: newtype QuietT (m :: Type -> Type) a
- Text.Chatty.Scanner: runInRedirFT :: (Functor m, MonadIO m, ChFinalizer m) => InRedirT m a -> FilePath -> m a
+ Text.Chatty.Scanner: runInRedirFT :: (Functor m, MonadResource m) => InRedirT m a -> FilePath -> m a
- Text.Chatty.Scanner: type InRedir = InRedirT (HandleCloserT IO)
+ Text.Chatty.Scanner: type InRedir = InRedirT IO
- Text.Chatty.Scanner.Buffered: ScannerBuffer :: ([String] -> m (a, [String])) -> ScannerBufferT m a
+ Text.Chatty.Scanner.Buffered: ScannerBuffer :: ([String] -> m (a, [String])) -> ScannerBufferT (m :: Type -> Type) a
- Text.Chatty.Scanner.Buffered: [runScannerBufferT] :: ScannerBufferT m a -> [String] -> m (a, [String])
+ Text.Chatty.Scanner.Buffered: [runScannerBufferT] :: ScannerBufferT (m :: Type -> Type) a -> [String] -> m (a, [String])
- Text.Chatty.Scanner.Buffered: class ChScanner m => ChBufferedScanner m
+ Text.Chatty.Scanner.Buffered: class ChScanner m => ChBufferedScanner (m :: Type -> Type)
- Text.Chatty.Scanner.Buffered: class ChBufferedScanner m => ChStackBufferedScanner m
+ Text.Chatty.Scanner.Buffered: class ChBufferedScanner m => ChStackBufferedScanner (m :: Type -> Type)
- Text.Chatty.Scanner.Buffered: newtype ScannerBufferT m a
+ Text.Chatty.Scanner.Buffered: newtype ScannerBufferT (m :: Type -> Type) a
Files
- CHANGELOG.md +9/−0
- Text/Chatty/Channel/Broadcast.hs +2/−2
- Text/Chatty/Channel/Printer.hs +9/−12
- Text/Chatty/Expansion.hs +2/−3
- Text/Chatty/Expansion/History.hs +3/−4
- Text/Chatty/Expansion/Vars.hs +2/−3
- Text/Chatty/Extended/ANSI.hs +3/−6
- Text/Chatty/Extended/HTML.hs +3/−6
- Text/Chatty/Extended/Printer.hs +1/−3
- Text/Chatty/Finalizer.hs +0/−71
- Text/Chatty/Interactor.hs +18/−20
- Text/Chatty/Interactor/Templates.hs +4/−30
- Text/Chatty/Printer.hs +36/−38
- Text/Chatty/Scanner.hs +27/−36
- Text/Chatty/Scanner/Buffered.hs +7/−8
- chatty.cabal +3/−9
CHANGELOG.md view
@@ -1,5 +1,14 @@ # Revision history for chatty +## 0.9.0.0 -- 2021-??-??++* Renamed DeafT to DiscardT (it had nothing to do with deafness).+* Removed many dependencies.+* runOutRedirFT and runInRedirFT are now constrained on MonadResource. +* RedirectionTarget is now a five-param class and the constraints depend on the instance. For file paths, it is MonadResource, but for DiscardO and RecordO it is relaxed to Monad (previously MonadIO for all instances).+* Same for RedirectionSource.+* The module Text.Chatty.Finalizer has been removed, including HandleCloserT and ChFinalizer. Instead, we're using MonadResource and ResourceT now.+ ## 0.8.0.0 -- 2021-01-04 Purged many modules from 0.7.0.0 that encouraged antipatterns and were far away from the original core idea of chatty. Affected modules.
Text/Chatty/Channel/Broadcast.hs view
@@ -1,7 +1,7 @@-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, Safe #-}+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.
Text/Chatty/Channel/Printer.hs view
@@ -1,7 +1,7 @@-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, Safe #-}+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -62,7 +62,6 @@ newtype ArchiverT c m a = Archiver { runArchiverT' :: ([(c,[String])],[c]) -> m (a,([(c,[String])],[c])) } instance Monad m => Monad (ArchiverT c m) where- return a = Archiver $ \s -> return (a,s) (Archiver r) >>= f = Archiver $ \s -> do (a,s') <- r s; runArchiverT' (f a) s' instance MonadTrans (ArchiverT c) where@@ -72,11 +71,11 @@ liftIO = lift . liftIO instance Monad m => Functor (ArchiverT c m) where- fmap f a = liftM f a+ fmap = liftM instance Monad m => Applicative (ArchiverT c m) where (<*>) = ap- pure = return+ pure a = Archiver $ \s -> return (a,s) withAssoc :: Eq b => b -> a -> (a -> a) -> [(b,a)] -> [(b,a)] withAssoc k n f [] = [(k,f n)]@@ -97,7 +96,7 @@ cthis = Archiver $ \(r,c) -> return (head c,(r,c)) runArchiverT :: (Eq c,Monad m) => c -> ArchiverT c m a -> m (a,[(c,Replayable)])-runArchiverT c = liftM (second $ map (second Replayable) . fst) . flip runArchiverT' ([],[c])+runArchiverT c = fmap (second $ map (second Replayable) . fst) . flip runArchiverT' ([],[c]) type IntArchiverT = ArchiverT Int type BoolArchiverT = ArchiverT Bool@@ -107,7 +106,6 @@ newtype FilterT c m a = Filter { runFilterT :: (c,[c]) -> m (a,[c]) } instance Monad m => Monad (FilterT c m) where- return a = Filter $ \(c,s) -> return (a,s) (Filter g) >>= f = Filter $ \(c,s) -> do (a,s') <- g (c,s); runFilterT (f a) (c,s') instance MonadTrans (FilterT c) where@@ -117,10 +115,10 @@ liftIO = lift . liftIO instance Monad m => Functor (FilterT c m) where- fmap f a = liftM f a+ fmap = liftM instance Monad m => Applicative (FilterT c m) where- pure = return+ pure a = Filter $ \(c,s) -> return (a,s) (<*>) = ap instance (Eq c,ChPrinter m) => ChPrinter (FilterT c m) where@@ -144,7 +142,6 @@ newtype JoinerT m a = Joiner { runJoinerT :: m a } instance Monad m => Monad (JoinerT m) where- return a = Joiner $ return a (Joiner j) >>= f = Joiner $ do a <- j; runJoinerT (f a) instance MonadTrans JoinerT where@@ -158,7 +155,7 @@ instance (Functor m, Monad m) => Applicative (JoinerT m) where (<*>) = ap- pure = return+ pure a = Joiner $ return a instance ChPrinter m => ChPrinter (JoinerT m) where mprint = lift . mprint@@ -169,4 +166,4 @@ cfin _ = return () cbracket _ m = m cthis = return undefined- cprint _ s = mprint s+ cprint _ = mprint
Text/Chatty/Expansion.hs view
@@ -2,7 +2,7 @@ {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -37,7 +37,6 @@ newtype NullExpanderT m a = NullExpander { runNullExpanderT :: m a } instance Monad m => Monad (NullExpanderT m) where- return = NullExpander . return (NullExpander ne) >>= f = NullExpander $ do ne' <- ne; runNullExpanderT (f ne') instance MonadTrans NullExpanderT where@@ -48,7 +47,7 @@ instance (Functor m, Monad m) => Applicative (NullExpanderT m) where (<*>) = ap- pure = return+ pure = NullExpander . return instance MonadIO m => MonadIO (NullExpanderT m) where liftIO = lift . liftIO
Text/Chatty/Expansion/History.hs view
@@ -2,7 +2,7 @@ {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -37,7 +37,6 @@ } instance Monad m => Monad (HistoryT m) where- return a = History $ \s -> return (a,s) (History h) >>= f = History $ \s -> do (a,s') <- h s; runHistoryT (f a) s' instance MonadTrans HistoryT where@@ -51,7 +50,7 @@ instance Monad m => Applicative (HistoryT m) where (<*>) = ap- pure = return+ pure a = History $ \s -> return (a,s) class Monad he => ChHistoryEnv he where mcounth :: he Int@@ -84,4 +83,4 @@ expand = lift . expand <=< expandHist withHistory :: Monad m => HistoryT m a -> m a-withHistory = liftM fst . flip runHistoryT []+withHistory = fmap fst . flip runHistoryT []
Text/Chatty/Expansion/Vars.hs view
@@ -2,7 +2,7 @@ {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -51,7 +51,6 @@ } instance Monad m => Monad (ExpanderT m) where- return a = Expander $ \vs -> return (a,vs) (Expander e) >>= f = Expander $ \vs -> do (a,vs') <- e vs; runExpanderT (f a) vs' instance MonadTrans ExpanderT where@@ -65,7 +64,7 @@ instance Monad m => Applicative (ExpanderT m) where (<*>) = ap- pure = return+ pure a = Expander $ \vs -> return (a,vs) -- | Run this function inside a blank environment. localEnvironment :: Functor m => ExpanderT m a -> m a
Text/Chatty/Extended/ANSI.hs view
@@ -1,8 +1,6 @@-{-# LANGUAGE Safe #-}- {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -37,7 +35,6 @@ newtype AnsiPrinterT m a = AnsiPrinter { runAnsiPrinterT :: [Colour] -> m (a,[Colour]) } instance Monad m => Monad (AnsiPrinterT m) where- return a = AnsiPrinter $ \s -> return (a,s) (AnsiPrinter p) >>= f = AnsiPrinter $ \s -> do (a,s') <- p s; runAnsiPrinterT (f a) s' instance MonadTrans AnsiPrinterT where@@ -47,7 +44,7 @@ fmap f a = AnsiPrinter $ \s -> do (a',s') <- runAnsiPrinterT a s; return (f a',s') instance Monad m => Applicative (AnsiPrinterT m) where- pure = return+ pure a = AnsiPrinter $ \s -> return (a,s) (<*>) = ap instance MonadIO m => MonadIO (AnsiPrinterT m) where@@ -74,7 +71,7 @@ instance (Functor m,ChExpand m) => ChExpand (AnsiPrinterT m) where expand s = AnsiPrinter $ \cx -> do- s1 <- (expand =<<) $ liftM (replay.snd) $ runRecorderT $ liftM fst $ flip runAnsiPrinterT cx $ expandClr s+ s1 <- (expand =<<) $ fmap (replay.snd) $ runRecorderT $ fmap fst $ flip runAnsiPrinterT cx $ expandClr s return (s1, cx) -- | Convert Chatty's colour intensity to ansi-terminal's one
Text/Chatty/Extended/HTML.hs view
@@ -1,8 +1,6 @@-{-# LANGUAGE Safe #-}- {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -36,7 +34,6 @@ newtype HtmlPrinterT m a = HtmlPrinter { runHtmlPrinterT :: m a } instance Monad m => Monad (HtmlPrinterT m) where- return = HtmlPrinter . return (HtmlPrinter p) >>= f = HtmlPrinter $ do p' <- p; runHtmlPrinterT (f p') instance MonadTrans HtmlPrinterT where@@ -47,7 +44,7 @@ instance (Functor m, Monad m) => Applicative (HtmlPrinterT m) where (<*>) = ap- pure = return+ pure = HtmlPrinter . return instance MonadIO m => MonadIO (HtmlPrinterT m) where liftIO = lift . liftIO@@ -63,7 +60,7 @@ efin = lift $ mprint "</span>" instance (Functor m,ChExpand m) => ChExpand (HtmlPrinterT m) where- expand = lift . expand <=< liftM (replay.snd) . runRecorderT . runHtmlPrinterT . expandClr+ expand = lift . expand <=< fmap (replay.snd) . runRecorderT . runHtmlPrinterT . expandClr -- | Convert the given character to its HTML representation. maskHtml :: Char -> String
Text/Chatty/Extended/Printer.hs view
@@ -1,8 +1,6 @@-{-# LANGUAGE Safe #-}- {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.
− Text/Chatty/Finalizer.hs
@@ -1,71 +0,0 @@-{-# LANGUAGE Safe #-}--{-- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs-- All wrongs reversed. Sharing is an act of love, not crime.- Please share Antisplice with everyone you like.-- Chatty is free software: you can redistribute it and/or modify- it under the terms of the GNU Affero General Public License as published by- the Free Software Foundation, either version 3 of the License, or- (at your option) any later version.-- Chatty is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU Affero General Public License for more details.-- You should have received a copy of the GNU Affero General Public License- along with Chatty. If not, see <http://www.gnu.org/licenses/>.--}---- | Provides handle-closing.-module Text.Chatty.Finalizer where--import Control.Applicative-import Control.Monad-import Control.Monad.IO.Class-import Control.Monad.Trans.Class-import System.IO---- | Class for all handle-finalizing monads. Required for file redirections.-class Monad m => ChFinalizer m where- -- | Enqueue handle- mqfh :: Handle -> m ()- -- | Enqueue list of handles- mqfhs :: [Handle] -> m ()- mqfhs = foldr ((>>) . mqfh) (return ())- -- | Finalize all queued handles- mfin :: m ()---- | Handle-closing transformer-newtype HandleCloserT m a = HandleCloser { runHandleCloserT :: [Handle] -> m (a,[Handle]) }--instance Monad m => Monad (HandleCloserT m) where- return a = HandleCloser $ \hs -> return (a,hs)- (HandleCloser m) >>= f = HandleCloser $ \hs -> do (a,hs') <- m hs; runHandleCloserT (f a) hs'--instance MonadTrans HandleCloserT where- lift m = HandleCloser $ \hs -> do a <- m; return (a,hs)--instance Monad m => Functor (HandleCloserT m) where- fmap f a = HandleCloser $ \hs -> do (a',hs') <- runHandleCloserT a hs; return (f a',hs')--instance Monad m => Applicative (HandleCloserT m) where- (<*>) = ap- pure = return--instance MonadIO m => MonadIO (HandleCloserT m) where- liftIO = lift . liftIO--instance MonadIO m => ChFinalizer (HandleCloserT m) where- mqfh h = HandleCloser $ \hs -> return ((),h:hs)- mfin = HandleCloser $ \hs -> do- sequence_ $ fmap (liftIO.hClose) hs- return ((),[])---- | Run function with handle closer-withLazyIO :: (MonadIO m,Functor m) => HandleCloserT m a -> m a-withLazyIO m = fmap fst $ runHandleCloserT (do a <- m; mfin; return a) []
Text/Chatty/Interactor.hs view
@@ -1,8 +1,8 @@-{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies, TemplateHaskell, FlexibleContexts, TypeSynonymInstances, UndecidableInstances, Trustworthy #-}+{-# LANGUAGE FlexibleInstances, FunctionalDependencies, TemplateHaskell, FlexibleContexts, UndecidableInstances, Trustworthy #-} {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -29,7 +29,6 @@ import Text.Chatty.Printer import Text.Chatty.Scanner import Text.Chatty.Scanner.Buffered-import Text.Chatty.Finalizer import Text.Chatty.Expansion import Text.Chatty.Expansion.Vars import Text.Chatty.Expansion.History@@ -43,21 +42,20 @@ import Control.Monad.Identity import System.IO -mkInteractor ''RecorderT mkScanner mkBufferedScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkCounter mkAtoms -mkInteractor ''DeafT mkScanner mkBufferedScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkCounter mkAtoms -mkInteractor ''OutRedirT mkScanner mkBufferedScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkCounter mkAtoms -mkInteractor ''HandleCloserT mkScanner mkBufferedScanner mkPrinter mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms -mkInteractor ''ExpanderT mkScanner mkBufferedScanner mkPrinter mkFinalizer mkHistoryEnv mkDefCP mkCounter mkAtoms +mkInteractor ''RecorderT mkScanner mkBufferedScanner mkExpander mkExpanderEnv mkHistoryEnv mkCounter mkAtoms +mkInteractor ''DiscardT mkScanner mkBufferedScanner mkExpander mkExpanderEnv mkHistoryEnv mkCounter mkAtoms +mkInteractor ''OutRedirT mkScanner mkBufferedScanner mkExpander mkExpanderEnv mkHistoryEnv mkCounter mkAtoms +mkInteractor ''ExpanderT mkScanner mkBufferedScanner mkPrinter mkHistoryEnv mkDefCP mkCounter mkAtoms mkInteractor ''HereStringT mkPrinter mkExtendedPrinter mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms mkInteractor ''QuietT mkPrinter mkExtendedPrinter mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms mkInteractor ''InRedirT mkPrinter mkExtendedPrinter mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms -mkInteractor ''HtmlPrinterT mkScanner mkBufferedScanner mkExpanderEnv mkHistoryEnv mkFinalizer mkDefCP mkCounter mkAtoms -mkInteractor ''AnsiPrinterT mkScanner mkBufferedScanner mkExpanderEnv mkHistoryEnv mkFinalizer mkDefCP mkCounter mkAtoms -mkInteractor ''NullExpanderT mkScanner mkBufferedScanner mkPrinter mkExtendedPrinter mkFinalizer mkDefCP mkCounter mkAtoms -mkInteractor ''HistoryT mkScanner mkBufferedScanner mkPrinter mkExtendedPrinter mkFinalizer mkExpanderEnv mkDefCP mkCounter mkAtoms -mkInteractor ''ScannerBufferT mkPrinter mkExtendedPrinter mkExpander mkExpanderEnv mkHistoryEnv mkFinalizer mkDefCP mkCounter mkAtoms-mkInteractor ''CounterT mkScanner mkPrinter mkBufferedScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkExtendedPrinter-mkInteractor ''AtomStoreT mkScanner mkPrinter mkBufferedScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkExtendedPrinter+mkInteractor ''HtmlPrinterT mkScanner mkBufferedScanner mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms +mkInteractor ''AnsiPrinterT mkScanner mkBufferedScanner mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms +mkInteractor ''NullExpanderT mkScanner mkBufferedScanner mkPrinter mkExtendedPrinter mkDefCP mkCounter mkAtoms +mkInteractor ''HistoryT mkScanner mkBufferedScanner mkPrinter mkExtendedPrinter mkExpanderEnv mkDefCP mkCounter mkAtoms +mkInteractor ''ScannerBufferT mkPrinter mkExtendedPrinter mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkCounter mkAtoms+mkInteractor ''CounterT mkScanner mkPrinter mkBufferedScanner mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkExtendedPrinter+mkInteractor ''AtomStoreT mkScanner mkPrinter mkBufferedScanner mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkExtendedPrinter mkInteractor ''IntArchiverT mkArchiver mkInteractor ''BoolArchiverT mkArchiver mkInteractor ''HandleArchiverT mkArchiver@@ -67,7 +65,7 @@ mkInteractor ''JoinerT mkArchiver -- | IgnorantT ignores all output and does not provide any input.-type IgnorantT m = QuietT (DeafT m)+type IgnorantT m = QuietT (DiscardT m) -- | Ignorant is IgnorantT on the identity type Ignorant = IgnorantT Identity -- | ChattyT simulates a console, actually taking input as a string and recording output.@@ -77,14 +75,14 @@ -- | Run IgnorantT (does not take anything) runIgnorantT :: Monad m => IgnorantT m a -> m a-runIgnorantT = runDeafT . runQuietT+runIgnorantT = runDiscardT . runQuietT -- | Run Ignorant (does not take anything) runIgnorant :: Ignorant a -> a runIgnorant = runIdentity . runIgnorantT -- | Run ChattyT. Takes input as a string and returns (result, remaining input, output).-runChattyT :: (Monad m,Functor m) => ChattyT m a -> String -> m (a,String,Replayable)+runChattyT :: Monad m => ChattyT m a -> String -> m (a,String,Replayable) runChattyT m input = fmap (\((a,u),r) -> (a,u,r)) $ runRecorderT $ runHereStringT m input -- | Run Chatty. Takes input as a string and returns (result, remaining input, output).@@ -93,13 +91,13 @@ -- Shell-like syntax -- | Connect the output of some function to the input of another one. Compare with a pipe (cmd1 | cmd2).-(.|.) :: (Monad m,Functor m) => RecorderT m a -> HereStringT m b -> m b+(.|.) :: Monad m => RecorderT m a -> HereStringT m b -> m b m1 .|. m2 = do (_,r) <- runRecorderT m1 fmap fst $ runHereStringT m2 (replay r) -- | Runs the second function and feeds its output as an argument to the first one. Compare with process expansion ($(cmd)).-(.<$.) :: (Functor m,Monad m) => (String -> m b) -> RecorderT m a -> m b+(.<$.) :: Monad m => (String -> m b) -> RecorderT m a -> m b m1 .<$. m2 = do (_,r) <- runRecorderT m2 m1 $ replay r
Text/Chatty/Interactor/Templates.hs view
@@ -2,7 +2,7 @@ {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -22,14 +22,13 @@ -} -- | Declares serveral templates for comfortable instance derivation-module Text.Chatty.Interactor.Templates (mkScanner, mkPrinter, mkFinalizer, mkExpander,mkExpanderEnv,mkHistoryEnv,mkInteractor,mkChatty,mkChannelPrinter,mkDefCP,mkArchiver,mkExtendedPrinter,mkBufferedScanner,mkCounter,mkAtoms) where+module Text.Chatty.Interactor.Templates (mkScanner, mkPrinter, mkExpander,mkExpanderEnv,mkHistoryEnv,mkInteractor,mkChatty,mkChannelPrinter,mkDefCP,mkArchiver,mkExtendedPrinter,mkBufferedScanner,mkCounter,mkAtoms) where import Data.Chatty.Atoms import Data.Chatty.Counter import Text.Chatty.Scanner import Text.Chatty.Scanner.Buffered import Text.Chatty.Printer-import Text.Chatty.Finalizer import Text.Chatty.Expansion import Text.Chatty.Expansion.Vars import Text.Chatty.Expansion.History@@ -97,35 +96,10 @@ where sx = strToType s cx = strToType c -{-- | Automatically derives a Broadcaster instance for you.-mkBroadcaster :: Name -> Name -> Q [Dec]-mkBroadcaster c s = [d|- instance Broadcaster $cx m => Broadcaster $cx ($sx m) where- bprint b = lift . bprint (lift . b)- instance BroadcasterBracket $cx m => BroadcasterBracket $cx ($sx m) where- bstart b = lift $ bstart (lift . b)- bfin b = lift $ bfin (lift . b)- |]- where sx = strToType s- cx = strToType c-}- -- | Automatically derives ChChannelPrinter instances for 'Int', 'Bool' and 'Handle' channels. mkDefCP :: Name -> Q [Dec] mkDefCP s = mkInteractor s (mkChannelPrinter ''Int) (mkChannelPrinter ''Bool) (mkChannelPrinter ''Handle) -{-- | Automatically derives Broadcaster instances for 'Int', 'Bool' and 'Handle' channels-mkDefBC :: Name -> Q [Dec]-mkDefBC s = mkInteractor s (mkBroadcaster ''Int) (mkBroadcaster ''Bool) (mkBroadcaster ''Handle)-}---- | Automatically derives a ChFinalizer instance for you.-mkFinalizer :: Name -> Q [Dec]-mkFinalizer s = [d|- instance ChFinalizer m => ChFinalizer ($sx m) where- mqfh = lift . mqfh- mfin = lift mfin- |] - where sx = strToType s- -- | Automatically derives a ChExpand instance for you. mkExpander :: Name -> Q [Dec] mkExpander s = [d|@@ -174,7 +148,7 @@ -- | Automatically derives all chatty typeclasses for you. mkChatty :: Name -> Q [Dec] mkChatty s = mkInteractor s- mkPrinter mkScanner mkFinalizer mkExpander+ mkPrinter mkScanner mkExpander mkExpanderEnv mkHistoryEnv mkDefCP mkExtendedPrinter mkBufferedScanner mkCounter mkAtoms@@ -183,7 +157,7 @@ mkArchiver :: Name -> Q [Dec] mkArchiver s = mkInteractor s mkScanner mkExpander mkExpanderEnv- mkHistoryEnv mkFinalizer+ mkHistoryEnv mkCounter mkAtoms -- | Just a helper class for mkInteractor
Text/Chatty/Printer.hs view
@@ -1,8 +1,8 @@-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies, Safe #-}+{-# LANGUAGE FlexibleInstances, FunctionalDependencies, ConstraintKinds, KindSignatures #-} {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -30,7 +30,9 @@ import Control.Monad.State import Control.Monad.Identity import Control.Monad.Writer+import Control.Monad.Trans.Resource import System.IO+import Data.Kind -- | A typeclass for all monads that may output strings. class Monad m => ChPrinter m where@@ -51,27 +53,26 @@ mnoecho _ = return () mflush = hFlush stdout --- | DeafT discards all output (much like >\/dev\/null in the shell)-newtype DeafT m a = Deaf { runDeafT :: m a }+-- | DiscardT discards all output (much like >\/dev\/null in the shell)+newtype DiscardT m a = Discard { runDiscardT :: m a } -instance Monad m => Monad (DeafT m) where- return = Deaf . return- (Deaf d) >>= f = Deaf $ do d' <- d; runDeafT (f d')+instance Monad m => Monad (DiscardT m) where+ (Discard d) >>= f = Discard $ do d' <- d; runDiscardT (f d') -instance MonadTrans DeafT where- lift = Deaf+instance MonadTrans DiscardT where+ lift = Discard -instance (Functor m, Monad m) => Applicative (DeafT m) where- pure = return+instance (Functor m, Monad m) => Applicative (DiscardT m) where+ pure = Discard . return (<*>) = ap -instance Functor m => Functor (DeafT m) where- fmap f (Deaf a) = Deaf $ fmap f a+instance Functor m => Functor (DiscardT m) where+ fmap f (Discard a) = Discard $ fmap f a -instance MonadIO m => MonadIO (DeafT m) where+instance MonadIO m => MonadIO (DiscardT m) where liftIO = lift . liftIO -instance Monad m => ChPrinter (DeafT m) where+instance Monad m => ChPrinter (DiscardT m) where mprint _ = return () -- Definition of OutRedirT + instances@@ -81,11 +82,10 @@ type OutRedir = OutRedirT IO instance Monad m => Monad (OutRedirT m) where- return a = OutRedir $ \h -> return a (OutRedir r) >>= f = OutRedir $ \h -> do a <- r h; runOutRedirT (f a) h instance MonadTrans OutRedirT where- lift m = OutRedir $ \h -> m+ lift m = OutRedir $ \_ -> m instance MonadIO m => MonadIO (OutRedirT m) where liftIO = lift . liftIO@@ -98,27 +98,26 @@ fmap f a = OutRedir $ \h -> do a' <- runOutRedirT a h; return (f a') instance Monad m => Applicative (OutRedirT m) where- pure = return+ pure a = OutRedir $ \h -> return a (<*>) = ap +instance MonadResource m => MonadResource (OutRedirT m) where+ liftResourceT = lift . liftResourceT+ -- | Run 'OutRedir' with a 'Handle' runOutRedir :: OutRedir a -> Handle -> IO a runOutRedir = runOutRedirT -- | Run 'OutRedirT' with a 'FilePath'-runOutRedirFT :: (Functor m,MonadIO m) => OutRedirT m a -> FilePath -> IOMode -> m a+runOutRedirFT :: MonadResource m => OutRedirT m a -> FilePath -> IOMode -> m a runOutRedirFT m fp md | md `elem` [AppendMode,WriteMode] = do- h <- liftIO $ openFile fp md- a <- runOutRedirT m h- liftIO $ hClose h- return a+ (key, h) <- allocate (liftIO $ openFile fp md) (liftIO . hClose)+ a <- runOutRedirT m h+ a `seq` release key+ return a | otherwise = error "runOutRedirFT does only accept AppendMode or WriteMode." --- | Run 'OutRedir' with a 'FilePath'-runOutRedirF :: OutRedir a -> FilePath -> IOMode -> IO a-runOutRedirF = runOutRedirFT- -- Definition of RecorderT + instances -- | Catches all output (much like VAR=$(...) in the shell) newtype RecorderT m a = Recorder { runRecorderT' :: m (a,[String]) }@@ -126,7 +125,6 @@ type Recorder = RecorderT Identity instance Monad m => Monad (RecorderT m) where- return a = Recorder $ return (a,[]) (Recorder r) >>= f = Recorder $ do (a,s) <- r (a',s') <- runRecorderT' (f a)@@ -143,7 +141,7 @@ instance Monad m => Applicative (RecorderT m) where (<*>) = ap- pure = return+ pure a = Recorder $ return (a,[]) instance MonadIO m => MonadIO (RecorderT m) where liftIO = lift . liftIO@@ -163,7 +161,7 @@ runRecorder = second Replayable . runIdentity . runRecorderT' -- | Run 'RecorderT' and also return its state.-runRecorderT :: (Functor m,Monad m) => RecorderT m a -> m (a,Replayable)+runRecorderT :: Monad m => RecorderT m a -> m (a,Replayable) runRecorderT = fmap (second Replayable) . runRecorderT' -- | Line-terminating alternative to 'mprint'@@ -180,18 +178,18 @@ -- | Redirection target that records input. data RecordO = RecordO -- | Class for all redirection targets.-class RedirectionTarget t mt a r | t -> mt, t a -> r where+class RedirectionTarget t (c :: (* -> *) -> Constraint) mt a r | t -> mt c, t a -> r where -- | Overwriting redirection.- (.>.) :: (Functor m,MonadIO m,ChPrinter (mt m)) => mt m a -> t -> m r+ (.>.) :: (c m,ChPrinter (mt m)) => mt m a -> t -> m r -- | Appending redirection.- (.>>.) :: (Functor m,MonadIO m,ChPrinter (mt m)) => mt m a -> t -> m r+ (.>>.) :: (c m,ChPrinter (mt m)) => mt m a -> t -> m r (.>>.) = (.>.)-instance RedirectionTarget DiscardO DeafT a a where- m .>. _ = runDeafT m-instance RedirectionTarget RecordO RecorderT a (a,Replayable) where+instance RedirectionTarget DiscardO Monad DiscardT a a where+ m .>. _ = runDiscardT m+instance RedirectionTarget RecordO Monad RecorderT a (a,Replayable) where m .>. _ = runRecorderT m-instance RedirectionTarget FilePath OutRedirT a a where+instance RedirectionTarget FilePath MonadResource OutRedirT a a where m .>. fp = runOutRedirFT m fp WriteMode m .>>. fp = runOutRedirFT m fp AppendMode-instance RedirectionTarget Handle OutRedirT a a where+instance RedirectionTarget Handle MonadIO OutRedirT a a where m .>. fp = runOutRedirT m fp
Text/Chatty/Scanner.hs view
@@ -1,8 +1,8 @@-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies, Safe #-}+{-# LANGUAGE FlexibleInstances, FunctionalDependencies, ConstraintKinds, KindSignatures #-} {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -24,13 +24,14 @@ -- | Provides a typeclass for all monads that may scan text. module Text.Chatty.Scanner where -import Text.Chatty.Finalizer import Control.Applicative import Control.Monad import Control.Monad.State import Control.Monad.Identity import Control.Monad.Trans.Class+import Control.Monad.Trans.Resource import System.IO+import Data.Kind -- | A typeclass for all monads that may read input. class Monad m => ChScanner m where@@ -73,7 +74,6 @@ newtype HereStringT m a = HereString { runHereStringT :: String -> m (a,String) } instance Monad m => Monad (HereStringT m) where- return a = HereString $ \s -> return (a,s) (HereString h) >>= f = HereString $ \s -> do (a,s') <- h s; runHereStringT (f a) s' instance MonadTrans HereStringT where@@ -84,7 +84,7 @@ instance Monad m => Applicative (HereStringT m) where (<*>) = ap- pure = return+ pure a = HereString $ \s -> return (a,s) instance Monad m => ChScanner (HereStringT m) where mscan1 = HereString $ \(s:ss) -> return (s,ss)@@ -95,16 +95,14 @@ instance MonadIO m => MonadIO (HereStringT m) where liftIO = lift . liftIO -instance ChFinalizer m => ChFinalizer (HereStringT m) where- mqfh = lift . mqfh- mfin = lift mfin+instance MonadResource m => MonadResource (HereStringT m) where+ liftResourceT = lift . liftResourceT -- Definition of QuietT + instances -- | QuietT does not convey any input (much like </dev/null in the shell) newtype QuietT m a = Quiet { runQuietT :: m a } instance Monad m => Monad (QuietT m) where- return = Quiet . return (Quiet q) >>= f = Quiet $ do q' <- q; runQuietT (f q') instance MonadTrans QuietT where@@ -119,61 +117,54 @@ instance Functor m => Functor (QuietT m) where fmap f (Quiet a) = Quiet $ fmap f a -instance (Functor m, Monad m) => Applicative (QuietT m) where+instance Monad m => Applicative (QuietT m) where (<*>) = ap- pure = return+ pure = Quiet . return -- Definition of InRedirT + instances -- | InRedirT redirects all input to a given handle (much like <filename in the shell) newtype InRedirT m a = InRedir { runInRedirT :: Handle -> m a } -- | InRedirT on an IO monad-type InRedir = InRedirT (HandleCloserT IO)+type InRedir = InRedirT IO instance Monad m => Monad (InRedirT m) where- return a = InRedir $ \h -> return a (InRedir r) >>= f = InRedir $ \h -> do a <- r h; runInRedirT (f a) h instance MonadTrans InRedirT where- lift m = InRedir $ \h -> do a <- m; return a+ lift m = InRedir $ \_ -> m instance MonadIO m => MonadIO (InRedirT m) where liftIO = lift . liftIO instance MonadIO m => ChScanner (InRedirT m) where- mscan1 = InRedir $ \h -> do c <- liftIO $ hGetChar h; return c- mscanL = InRedir $ \h -> do s <- liftIO $ hGetContents h; return s- mscannable = InRedir $ \h -> do b <- liftIO $ hIsEOF h; return b+ mscan1 = InRedir $ \h -> liftIO (hGetChar h)+ mscanL = InRedir $ \h -> liftIO (hGetContents h)+ mscannable = InRedir $ \h -> liftIO (hIsEOF h) mscanh = InRedir $ \h -> return (Just h)- mready = InRedir $ \h -> do r <- liftIO $ hReady h; return r+ mready = InRedir $ \h -> liftIO (hReady h) instance Monad m => Functor (InRedirT m) where fmap f a = InRedir $ \h -> do a' <- runInRedirT a h; return (f a') instance Monad m => Applicative (InRedirT m) where (<*>) = ap- pure = return+ pure a = InRedir $ \h -> return a -instance ChFinalizer m => ChFinalizer (InRedirT m) where- mqfh = lift . mqfh- mfin = lift mfin+instance MonadResource m => MonadResource (InRedirT m) where+ liftResourceT = lift . liftResourceT -- | Run InRedir with handle runInRedir :: InRedir a -> Handle -> IO a-runInRedir m h = withLazyIO $ runInRedirT m h+runInRedir m h = runInRedirT m h -- | Run InRedirT with a filename-runInRedirFT :: (Functor m,MonadIO m,ChFinalizer m) => InRedirT m a -> FilePath -> m a+runInRedirFT :: (Functor m,MonadResource m) => InRedirT m a -> FilePath -> m a runInRedirFT m fp = do- h <- liftIO $ openFile fp ReadMode+ (key, h) <- allocate (liftIO $ openFile fp ReadMode) (liftIO . hClose) a <- runInRedirT m h- mqfh h- --liftIO $ hClose h+ a `seq` release key return a --- | Run InRedir with a filename-runInRedirF :: InRedir a -> FilePath -> IO a-runInRedirF m fp = withLazyIO $ runInRedirFT m fp- -- | Line-scanning alternative to mscan1/L mscanLn :: ChScanner m => m String mscanLn = do@@ -199,14 +190,14 @@ -- | Redirection source that does not provide any output data EmptyI = EmptyI -- | Class for all primitive redirection sources.-class RedirectionSource t mt a r | t -> mt, t a -> r where+class RedirectionSource t (c :: (* -> *) -> Constraint) mt a r | t -> mt c, t a -> r where -- | Redirection- (.<.) :: (ChFinalizer m,Functor m,MonadIO m,ChScanner (mt m)) => mt m a -> t -> m r-instance RedirectionSource EmptyI QuietT a a where+ (.<.) :: (c m,ChScanner (mt m)) => mt m a -> t -> m r+instance RedirectionSource EmptyI Monad QuietT a a where m .<. _ = runQuietT m-instance RedirectionSource FilePath InRedirT a a where+instance RedirectionSource FilePath MonadResource InRedirT a a where m .<. fp = runInRedirFT m fp-instance RedirectionSource Handle InRedirT a a where+instance RedirectionSource Handle MonadIO InRedirT a a where m .<. fp = runInRedirT m fp -- | Class for all Here-Documents class RedirectionHeredoc t mt a r | t -> mt, t a -> r where
Text/Chatty/Scanner/Buffered.hs view
@@ -1,8 +1,8 @@-{-# LANGUAGE FlexibleInstances, Safe #-}+{-# LANGUAGE FlexibleInstances #-} {- This module is part of Chatty.- Copyleft (c) 2014 Marvin Cohrs+ Copyleft (c) 2014,2021,2026 Enum Cohrs All wrongs reversed. Sharing is an act of love, not crime. Please share Antisplice with everyone you like.@@ -57,7 +57,6 @@ newtype ScannerBufferT m a = ScannerBuffer { runScannerBufferT :: [String] -> m (a,[String]) } instance Monad m => Monad (ScannerBufferT m) where- return a = ScannerBuffer $ \s -> return (a,s) (ScannerBuffer c) >>= f = ScannerBuffer $ \s -> do (a,s') <- c s; runScannerBufferT (f a) s' instance MonadTrans ScannerBufferT where@@ -68,20 +67,20 @@ instance Monad m => Applicative (ScannerBufferT m) where (<*>) = ap- pure = return+ pure a = ScannerBuffer $ \s -> return (a,s) instance ChScanner m => ChScanner (ScannerBufferT m) where- mscan1 = ScannerBuffer $ \(ss:sx) -> (if null ss then do s <- mscan1; return (s,[]:map (s:) sx) else return (head ss,tail ss:map (head ss:) sx))+ mscan1 = ScannerBuffer $ \(ss:sx) -> if null ss then do s <- mscan1; return (s,[]:map (s:) sx) else return (head ss,tail ss:map (head ss:) sx) mscanL = ScannerBuffer $ \(ss:sx) -> do l <- mscanL; return (ss++l, []:map (++l) sx)- mscannable = ScannerBuffer $ \(ss:sx) -> (if null ss then do b <- mscannable; return (b,[]:sx) else return (True,ss:sx))+ mscannable = ScannerBuffer $ \(ss:sx) -> if null ss then do b <- mscannable; return (b,[]:sx) else return (True,ss:sx) mscanh = return Nothing- mready = ScannerBuffer $ \(ss:sx) -> (if null ss then do b <- mready; return (b,[]:sx) else return (True,ss:sx))+ mready = ScannerBuffer $ \(ss:sx) -> if null ss then do b <- mready; return (b,[]:sx) else return (True,ss:sx) instance MonadIO m => MonadIO (ScannerBufferT m) where liftIO = lift . liftIO instance ChScanner m => ChBufferedScanner (ScannerBufferT m) where- mpeek1 = ScannerBuffer $ \(ss:sx) -> (if null ss then do s <- mscan1; return (s,[s]:sx) else return (head ss,ss:sx))+ mpeek1 = ScannerBuffer $ \(ss:sx) -> if null ss then do s <- mscan1; return (s,[s]:sx) else return (head ss,ss:sx) mprepend s = ScannerBuffer $ \(ss:sx) -> return ((),(s++ss):sx) instance ChScanner m => ChStackBufferedScanner (ScannerBufferT m) where
chatty.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.8.0.0+version: 0.8.0.1 -- A short (one-line) description of the package. synopsis: Some monad transformers and typeclasses for text in- and output abstraction.@@ -57,7 +57,6 @@ -- Modules exported by the library. exposed-modules: Text.Chatty.Expansion Text.Chatty.Printer- Text.Chatty.Finalizer Text.Chatty.Templates Text.Chatty.Scanner Text.Chatty.Interactor@@ -78,18 +77,13 @@ other-extensions: ExistentialQuantification, RankNTypes, Rank2Types, FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies, TemplateHaskell, QuasiQuotes, UndecidableInstances -- Other library packages from which modules are imported.- build-depends: base >=4.9 && <5.0,+ build-depends: base >=4.13 && <5.0, transformers,- directory,- process, mtl, template-haskell,- setenv,- unix,- random,- time >= 1.4, ansi-terminal >= 0.6, chatty-utils >= 0.7.1,+ resourcet, text -- Directories containing source files.