Safe Haskell | None |
---|---|
Language | Haskell2010 |
V2 makes the following changes from V1:
- withLocation now only takes a Location, using the current actor for player.
- Flips argument order for
validate
functions to be consistent with rest of API. activate
andtrigger
use the stack.- Fork has a saner API and reports properly.
formatter
now takes aStep
rather than anInt
.view
is re-exported since it will virtually always be required for normal formatters.
Synopsis
- triggerMentor :: CardName -> CardName -> ExceptT String (ReaderT Env (StateT Board (WriterT [Step] Identity))) ()
- gainLife :: Player -> Int -> GameMonad ()
- loseLife :: Player -> Int -> GameMonad ()
- setLife :: Player -> Int -> GameMonad ()
- run :: (Step -> Formatter) -> GameMonad () -> IO ()
- module Dovin.Actions
- module Dovin.Attributes
- module Dovin.Builder
- module Dovin.Formatting
- module Dovin.Helpers
- module Dovin.Types
- view :: MonadReader s m => Getting a s a -> m a
Documentation
triggerMentor :: CardName -> CardName -> ExceptT String (ReaderT Env (StateT Board (WriterT [Step] Identity))) () Source #
module Dovin.Actions
module Dovin.Attributes
module Dovin.Builder
module Dovin.Formatting
module Dovin.Helpers
module Dovin.Types
view :: MonadReader s m => Getting a s a -> m a #
View the value pointed to by a Getter
, Iso
or
Lens
or the result of folding over all the results of a
Fold
or Traversal
that points
at a monoidal value.
view
.
to
≡id
>>>
view (to f) a
f a
>>>
view _2 (1,"hello")
"hello"
>>>
view (to succ) 5
6
>>>
view (_2._1) ("hello",("world","!!!"))
"world"
As view
is commonly used to access the target of a Getter
or obtain a monoidal summary of the targets of a Fold
,
It may be useful to think of it as having one of these more restricted signatures:
view
::Getter
s a -> s -> aview
::Monoid
m =>Fold
s m -> s -> mview
::Iso'
s a -> s -> aview
::Lens'
s a -> s -> aview
::Monoid
m =>Traversal'
s m -> s -> m
In a more general setting, such as when working with a Monad
transformer stack you can use:
view
::MonadReader
s m =>Getter
s a -> m aview
:: (MonadReader
s m,Monoid
a) =>Fold
s a -> m aview
::MonadReader
s m =>Iso'
s a -> m aview
::MonadReader
s m =>Lens'
s a -> m aview
:: (MonadReader
s m,Monoid
a) =>Traversal'
s a -> m a