terminal-effectful
Safe HaskellNone
LanguageGHC2021

Effectful.Terminal.Dynamic

Description

Provides a dynamic terminal effect.

Since: 0.1

Synopsis

Effect

data Terminal (a :: Type -> Type) b where Source #

Dynamic terminal effect.

Since: 0.1

Constructors

PutStr :: forall (a :: Type -> Type). String -> Terminal a () 
PutStrLn :: forall (a :: Type -> Type). String -> Terminal a () 
PutBinary :: forall (a :: Type -> Type). ByteString -> Terminal a () 
GetChar :: forall (a :: Type -> Type). Terminal a Char 
GetLine :: forall (a :: Type -> Type). Terminal a [Char] 
GetContents' :: forall (a :: Type -> Type). Terminal a [Char] 
GetTerminalSize :: forall a1 (a :: Type -> Type). Integral a1 => Terminal a (Window a1) 
SupportsPretty :: forall (a :: Type -> Type). Terminal a Bool 

Instances

Instances details
ShowEffect Terminal Source #

Since: 0.1

Instance details

Defined in Effectful.Terminal.Dynamic

Methods

showEffectCons :: forall (m :: Type -> Type) a. Terminal m a -> String Source #

type DispatchOf Terminal Source #

Since: 0.1

Instance details

Defined in Effectful.Terminal.Dynamic

putStr :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => String -> Eff es () Source #

Lifted putStr.

Since: 0.1

putStrLn :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => String -> Eff es () Source #

Lifted putStrLn.

Since: 0.1

putBinary :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => ByteString -> Eff es () Source #

Lifted putStr.

Since: 0.1

getChar :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Eff es Char Source #

Lifted getChar.

Since: 0.1

getLine :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Eff es String Source #

Lifted getLine.

Since: 0.1

getContents' :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Eff es String Source #

Lifted getContents'.

Since: 0.1

getTerminalSize :: forall a (es :: [Effect]). (HasCallStack, Integral a, Terminal :> es) => Eff es (Window a) Source #

Retrieves the terminal size.

Since: 0.1

supportsPretty :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Eff es Bool Source #

Determines if we support ANSI styling.

Since: 0.1

Handlers

runTerminal :: forall (es :: [Effect]) a. (HasCallStack, IOE :> es) => Eff (Terminal ': es) a -> Eff es a Source #

Runs Terminal in IO.

Since: 0.1

Functions

print :: forall a (es :: [Effect]). (Show a, HasCallStack, Terminal :> es) => a -> Eff es () Source #

Since: 0.1

Text

putText :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Text -> Eff es () Source #

Text version of putStr.

Since: 0.1

putTextLn :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Text -> Eff es () Source #

Text version of putStrLn.

Since: 0.1

getTextLine :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Eff es Text Source #

Since: 0.1

getTextContents' :: forall (es :: [Effect]). (HasCallStack, Terminal :> es) => Eff es Text Source #

Since: 0.1

Window

getTerminalWidth :: forall a (es :: [Effect]). (HasCallStack, Integral a, Terminal :> es) => Eff es a Source #

Retrieves the terminal width.

Since: 0.1

getTerminalHeight :: forall a (es :: [Effect]). (HasCallStack, Integral a, Terminal :> es) => Eff es a Source #

Retrieves the terminal height.

Since: 0.1

Re-exports

data Window a Source #

Terminal window width and height

Constructors

Window 

Fields

Instances

Instances details
Functor Window Source # 
Instance details

Defined in System.Console.Terminal.Common

Methods

fmap :: (a -> b) -> Window a -> Window b #

(<$) :: a -> Window b -> Window a #

Foldable Window Source # 
Instance details

Defined in System.Console.Terminal.Common

Methods

fold :: Monoid m => Window m -> m #

foldMap :: Monoid m => (a -> m) -> Window a -> m #

foldMap' :: Monoid m => (a -> m) -> Window a -> m #

foldr :: (a -> b -> b) -> b -> Window a -> b #

foldr' :: (a -> b -> b) -> b -> Window a -> b #

foldl :: (b -> a -> b) -> b -> Window a -> b #

foldl' :: (b -> a -> b) -> b -> Window a -> b #

foldr1 :: (a -> a -> a) -> Window a -> a #

foldl1 :: (a -> a -> a) -> Window a -> a #

toList :: Window a -> [a] #

null :: Window a -> Bool #

length :: Window a -> Int #

elem :: Eq a => a -> Window a -> Bool #

maximum :: Ord a => Window a -> a #

minimum :: Ord a => Window a -> a #

sum :: Num a => Window a -> a #

product :: Num a => Window a -> a #

Traversable Window Source # 
Instance details

Defined in System.Console.Terminal.Common

Methods

traverse :: Applicative f => (a -> f b) -> Window a -> f (Window b) #

sequenceA :: Applicative f => Window (f a) -> f (Window a) #

mapM :: Monad m => (a -> m b) -> Window a -> m (Window b) #

sequence :: Monad m => Window (m a) -> m (Window a) #

Generic1 Window Source # 
Instance details

Defined in System.Console.Terminal.Common

Associated Types

type Rep1 Window 
Instance details

Defined in System.Console.Terminal.Common

type Rep1 Window = D1 ('MetaData "Window" "System.Console.Terminal.Common" "terminal-size-0.3.4-66d8cddaa48f37c4d19889a67a93422e834e8b135a9849e68b61d130e9d8d6bc" 'False) (C1 ('MetaCons "Window" 'PrefixI 'True) (S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Just "width") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))

Methods

from1 :: Window a -> Rep1 Window a #

to1 :: Rep1 Window a -> Window a #

Data a => Data (Window a) Source # 
Instance details

Defined in System.Console.Terminal.Common

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Window a -> c (Window a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Window a) #

toConstr :: Window a -> Constr #

dataTypeOf :: Window a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Window a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Window a)) #

gmapT :: (forall b. Data b => b -> b) -> Window a -> Window a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Window a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Window a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Window a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Window a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Window a -> m (Window a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Window a -> m (Window a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Window a -> m (Window a) #

Generic (Window a) Source # 
Instance details

Defined in System.Console.Terminal.Common

Associated Types

type Rep (Window a) 
Instance details

Defined in System.Console.Terminal.Common

type Rep (Window a) = D1 ('MetaData "Window" "System.Console.Terminal.Common" "terminal-size-0.3.4-66d8cddaa48f37c4d19889a67a93422e834e8b135a9849e68b61d130e9d8d6bc" 'False) (C1 ('MetaCons "Window" 'PrefixI 'True) (S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "width") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

Methods

from :: Window a -> Rep (Window a) x #

to :: Rep (Window a) x -> Window a #

Read a => Read (Window a) Source # 
Instance details

Defined in System.Console.Terminal.Common

Show a => Show (Window a) Source # 
Instance details

Defined in System.Console.Terminal.Common

Methods

showsPrec :: Int -> Window a -> ShowS #

show :: Window a -> String #

showList :: [Window a] -> ShowS #

Eq a => Eq (Window a) Source # 
Instance details

Defined in System.Console.Terminal.Common

Methods

(==) :: Window a -> Window a -> Bool #

(/=) :: Window a -> Window a -> Bool #

type Rep1 Window Source # 
Instance details

Defined in System.Console.Terminal.Common

type Rep1 Window = D1 ('MetaData "Window" "System.Console.Terminal.Common" "terminal-size-0.3.4-66d8cddaa48f37c4d19889a67a93422e834e8b135a9849e68b61d130e9d8d6bc" 'False) (C1 ('MetaCons "Window" 'PrefixI 'True) (S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Just "width") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))
type Rep (Window a) Source # 
Instance details

Defined in System.Console.Terminal.Common

type Rep (Window a) = D1 ('MetaData "Window" "System.Console.Terminal.Common" "terminal-size-0.3.4-66d8cddaa48f37c4d19889a67a93422e834e8b135a9849e68b61d130e9d8d6bc" 'False) (C1 ('MetaCons "Window" 'PrefixI 'True) (S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "width") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
PrintfArg Text #

Since: text-1.2.2.0

Instance details

Defined in Data.Text

Binary Text #

Since: text-1.2.1.0

Instance details

Defined in Data.Text

Methods

put :: Text -> Put #

get :: Get Text #

putList :: [Text] -> Put #

NFData Text # 
Instance details

Defined in Data.Text

Methods

rnf :: Text -> () #

Monoid Text # 
Instance details

Defined in Data.Text

Methods

mempty :: Text #

mappend :: Text -> Text -> Text #

mconcat :: [Text] -> Text #

Semigroup Text #

Beware: stimes will crash if the given number does not fit into an Int.

Since: text-1.2.2.0

Instance details

Defined in Data.Text

Methods

(<>) :: Text -> Text -> Text #

sconcat :: NonEmpty Text -> Text #

stimes :: Integral b => b -> Text -> Text #

Data Text #

This instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction.

This instance was created by copying the updated behavior of Data.Set.Set and Data.Map.Map. If you feel a mistake has been made, please feel free to submit improvements.

The original discussion is archived here: could we get a Data instance for Data.Text.Text?

The followup discussion that changed the behavior of Set and Map is archived here: Proposal: Allow gunfold for Data.Map, ...

Instance details

Defined in Data.Text

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Text -> c Text #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Text #

toConstr :: Text -> Constr #

dataTypeOf :: Text -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Text) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Text) #

gmapT :: (forall b. Data b => b -> b) -> Text -> Text #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Text -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Text -> r #

gmapQ :: (forall d. Data d => d -> u) -> Text -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Text -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Text -> m Text #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Text -> m Text #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Text -> m Text #

IsString Text #

Performs replacement on invalid scalar values:

>>> :set -XOverloadedStrings
>>> "\55555" :: Text
"\65533"
Instance details

Defined in Data.Text

Methods

fromString :: String -> Text #

IsList Text #

Performs replacement on invalid scalar values:

>>> :set -XOverloadedLists
>>> ['\55555'] :: Text
"\65533"

Since: text-1.2.0.0

Instance details

Defined in Data.Text

Associated Types

type Item Text 
Instance details

Defined in Data.Text

type Item Text = Char

Methods

fromList :: [Item Text] -> Text #

fromListN :: Int -> [Item Text] -> Text #

toList :: Text -> [Item Text] #

Read Text # 
Instance details

Defined in Data.Text

Show Text # 
Instance details

Defined in Data.Text.Show

Methods

showsPrec :: Int -> Text -> ShowS #

show :: Text -> String #

showList :: [Text] -> ShowS #

Eq Text # 
Instance details

Defined in Data.Text

Methods

(==) :: Text -> Text -> Bool #

(/=) :: Text -> Text -> Bool #

Ord Text # 
Instance details

Defined in Data.Text

Methods

compare :: Text -> Text -> Ordering #

(<) :: Text -> Text -> Bool #

(<=) :: Text -> Text -> Bool #

(>) :: Text -> Text -> Bool #

(>=) :: Text -> Text -> Bool #

max :: Text -> Text -> Text #

min :: Text -> Text -> Text #

Pretty Text Source #

Instance of Pretty for Text

Instance details

Defined in System.Console.Pretty

Lift Text #

Since: text-1.2.4.0

Instance details

Defined in Data.Text

Methods

lift :: Quote m => Text -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Text -> Code m Text #

type Item Text # 
Instance details

Defined in Data.Text

type Item Text = Char