module Effectful.Console.Effect
  ( -- * Effect
    Console

    -- ** Handlers
  , runConsole
  ) where

import Effectful
import Effectful.Dispatch.Static

-- | An effect for reading from/writing to 'System.IO.stdin', 'System.IO.stdout'
-- or 'System.IO.stderr'.
data Console :: Effect

type instance DispatchOf Console = Static WithSideEffects
data instance StaticRep Console = Console

-- | Run the 'Console' effect.
runConsole :: IOE :> es => Eff (Console : es) a -> Eff es a
runConsole :: forall (es :: [Effect]) a.
(IOE :> es) =>
Eff (Console : es) a -> Eff es a
runConsole = StaticRep Console -> Eff (Console : es) a -> Eff es a
forall (e :: Effect) (sideEffects :: SideEffects) (es :: [Effect])
       a.
(DispatchOf e ~ 'Static sideEffects, MaybeIOE sideEffects es) =>
StaticRep e -> Eff (e : es) a -> Eff es a
evalStaticRep StaticRep Console
Console