-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A game engine for playing werewolf within an arbitrary chat client
--   
--   A game engine for playing werewolf within an arbitrary chat client.
--   Werewolf is a well known social party game, commonly also called
--   Mafia. See the <a>Wikipedia article</a> for a rundown on its gameplay
--   and history.
@package werewolf
@version 1.5.1.1


-- | A response is used as a return result of calling the <tt>werewolf</tt>
--   binary. Each response has a list of associated messages.
--   
--   <tt>werewolf</tt> was designed to be ambivalent to the playing chat
--   client. The response-message structure reflects this by staying away
--   from anything that could be construed as client-specific. This
--   includes features such as emoji support.
module Game.Werewolf.Response

-- | When a user sends a command to the <tt>werewolf</tt> binary, a
--   response is always returned.
--   
--   The chat interface should then relay any <tt>messages</tt> from the
--   response. Whether or not the command was valid (indicated by the
--   <tt>ok</tt> flag) is often irrelevant as the returned
--   <tt>messages</tt> will include errors to the user.
data Response
Response :: Bool -> [Message] -> Response

-- | Boolean flag to indicate success.
[ok] :: Response -> Bool

-- | List of messages.
[messages] :: Response -> [Message]

-- | A successful, empty response.
success :: Response

-- | An unsuccessful, empty response.
failure :: Response

-- | Exits fast with the given response. The response is encoded as JSON,
--   printed to <tt>stdout</tt> and then the program is exited with
--   <tt>0</tt> (success).
--   
--   The program always exits with success even if the response was a
--   failure one. This is to distinguish between bad calls to the binary
--   and bad commands to the werewolf engine.
exitWith :: MonadIO m => Response -> m a

-- | A message may be either public or private, indicated by its
--   <tt>to</tt> field.
--   
--   Each message contains a single text field. This field is permitted to
--   contain special characters such as new lines and tabs.
data Message
Message :: Maybe Text -> Text -> Message

-- | The message recipient: <a>Nothing</a> for a public message,
--   <a>Just</a> for a private message.
[to] :: Message -> Maybe Text

-- | The message text.
[message] :: Message -> Text

-- | Creates a public message with the given text.
publicMessage :: Text -> Message

-- | <pre>
--   privateMessage to message
--   </pre>
--   
--   Creates a private message to <tt>to</tt> with the given text.
privateMessage :: Text -> Text -> Message

-- | <pre>
--   groupMessages tos message
--   </pre>
--   
--   Creates multiple private messages (1 to each recipient) with the given
--   text.
groupMessages :: [Text] -> Text -> [Message]
instance GHC.Show.Show Game.Werewolf.Response.Response
instance GHC.Generics.Generic Game.Werewolf.Response.Response
instance GHC.Classes.Eq Game.Werewolf.Response.Response
instance GHC.Show.Show Game.Werewolf.Response.Message
instance GHC.Generics.Generic Game.Werewolf.Response.Message
instance GHC.Classes.Eq Game.Werewolf.Response.Message
instance Data.Aeson.Types.FromJSON.FromJSON Game.Werewolf.Response.Response
instance Data.Aeson.Types.ToJSON.ToJSON Game.Werewolf.Response.Response
instance Data.Aeson.Types.FromJSON.FromJSON Game.Werewolf.Response.Message
instance Data.Aeson.Types.ToJSON.ToJSON Game.Werewolf.Response.Message


-- | Extra utility functions for working with the interpolate Quasi Quoter.
module Data.String.Interpolate.Extra
iFile :: QuasiQuoter


-- | Humanise type class for displaying data structures to a human.
module Data.String.Humanise
class Humanise a
humanise :: Humanise a => a -> Text
instance Data.String.Humanise.Humanise Data.Text.Internal.Text
instance Data.String.Humanise.Humanise a => Data.String.Humanise.Humanise [a]


-- | Roles are split into four categories:
--   
--   <ul>
--   <li>The Ambiguous.</li>
--   <li>The Loners.</li>
--   <li>The Villagers.</li>
--   <li>The Werewolves.</li>
--   </ul>
module Game.Werewolf.Role

-- | Role definitions require only a few pieces of information.
--   
--   The <tt>balance</tt> attribute on a role indicates the allegiance it
--   favours. For example, a Simple Werewolf has a balance of -4 while the
--   Seer has a balance of 2. A balance of 0 means it favours neither
--   allegiance.
--   
--   N.B., role equality is defined on just the <a>tag</a> as a role's
--   <a>allegiance</a> may change throughout the game.
data Role
tag :: Lens' Role Text
name :: Lens' Role Text
allegiance :: Lens' Role Allegiance
balance :: Lens' Role Int
activity :: Lens' Role Activity
description :: Lens' Role Text
rules :: Lens' Role Text

-- | The <a>NoOne</a> allegiance is used for the Loners. It is not used to
--   determine who has won (i.e., if one Loner wins, the others still
--   lose).
data Allegiance
NoOne :: Allegiance
Necromancer :: Allegiance
Villagers :: Allegiance
Werewolves :: Allegiance
_NoOne :: Prism' Allegiance ()
_Necromancer :: Prism' Allegiance ()
_Villagers :: Prism' Allegiance ()
_Werewolves :: Prism' Allegiance ()

-- | Defines whether a role is diurnal or nocturnal. I.e., if the role's
--   turn occurs during the day or night.
data Activity
Diurnal :: Activity
Nocturnal :: Activity
_Diurnal :: Prism' Activity ()
_Nocturnal :: Prism' Activity ()

-- | A list containing all the roles defined in this file.
allRoles :: [Role]

-- | A list containing roles that are restricted to a single instance per
--   <tt>Game</tt>.
--   
--   <pre>
--   <a>restrictedRoles</a> = <a>allRoles</a> \\ [<a>simpleVillagerRole</a>, <a>simpleWerewolfRole</a>, <a>spitefulVillagerRole</a>, <a>zombieRole</a>]
--   
--   </pre>
restrictedRoles :: [Role]

-- | <i>Abandoned by their parents as a child, with no-one wanting to look
--   after another mouth to</i> <i>feed, the Orphan was left to fend for
--   themself. No-one looked twice at the Orphan and even</i> <i>fewer
--   showed kindness towards the lonely child. One day however, one
--   townsperson changed all</i> <i>this. He offered the Orphan food, water
--   and a roof over their head. Grateful for his chairty</i> <i>and
--   affection, the Orphan made him their role model. Pray that no ill
--   should befall their</i> <i>role model, for they are the only one
--   conforming the Orphan as a Villager.</i>
--   
--   On the first night, the Orphan chooses a player to become their role
--   model. So long as the role model is alive, the Orphan is a Villager.
--   If however the role model is eliminated, then the Orphan becomes a
--   Werewolf.
orphanRole :: Role

-- | <i>Hah, maybe not as liked as the Jester, but the Drunk sure does
--   their fair share of stupid</i> <i>things in the night! No-one knows if
--   they even actually make it home; sometimes people see</i> <i>them
--   sleeping outside the Blacksmith's home, others say they see them
--   wandering towards the</i> <i>woods. It's pointless quizzing the
--   Village Drunk in the morning about their doings; they can</i> <i>never
--   remember what they did!</i>
--   
--   The Village Drunk is initially aligned with the Villagers.
--   
--   On the third night the Village Drunk sobers up and is randomly
--   assigned a new alignment, either Villagers or Werewolves.
villageDrunkRole :: Role

-- | <i>Normally the Dullahan carries their head under one arm, however
--   while amongst the Villagers,</i> <i>they ere on the side of caution
--   and rest it in a more traditional place. The Dullahan rides a</i>
--   <i>black horse as dark as night and hunts down travellers in the
--   countryside. Beware if the</i> <i>Dullahan knows your name, for you
--   are then marked for death and you should avoid them at all</i> /costs.
--   
--   The Dullahan is given a list of player names at the start of the game.
--   To win, they must eliminate all of them before the end of the game.
dullahanRole :: Role

-- | <i>Long ago during the War in Heaven, angels fell from the sky as one
--   by one those that followed</i> <i>Lucifer were defeated. For centuries
--   they lived amongst mortal Villagers as punishment for</i> <i>their
--   sins and wrongdoings. The Fallen Angel was one such being and is now
--   one of the few</i> <i>angels left on Earth. Nothing is worse
--   punishment for them, the Fallen Angel yearns for death</i> <i>to once
--   again be free!</i>
--   
--   The Fallen Angel wins if they manage to get lynched by the Villagers
--   before the end of the game.
fallenAngelRole :: Role

-- | <i>The dead are feared among the living; the dead outnumber the
--   living. In most villages the</i> <i>dead remain that way, but not when
--   the Necromancer is present. The Necromancer devoted their</i> <i>life
--   to learning black magic and methods of bringing people back to life.
--   Unfortunately this</i> <i>art is hard to perfect and all they can
--   manage to bring back are soulless Zombies.</i>
--   
--   Once per game the Necromancer can choose to resurrect all dead players
--   as Zombies. The Zombies are aligned with the Necromancer and they
--   cannot be lynched or devoured.
--   
--   If the Necromancer is killed, all Zombies die with them.
--   
--   The Necromancer and Zombies win if they are the last ones alive.
necromancerRole :: Role

-- | <i>A loyal follower of the Necromancer. A Zombie has no mind of its
--   own and blindly obeys every</i> <i>command of their master.</i>
--   
--   A Zombie wins with the Necromancer. They cannot be killed, however
--   they die when the Necromancer dies.
zombieRole :: Role

-- | <i>Awareness comes easy to the Beholder. They listen to their senses
--   and trust their hunches.</i> <i>Over the years the Beholder has grown
--   to know a certain few of the village just by paying</i> <i>attention.
--   Little cues here and there, the way someone talks, the way they move -
--   it all</i> <i>gives clues as to their true nature and role.</i>
--   
--   At the start of the game the Beholder is informed the Seer's identity.
beholderRole :: Role

-- | <i>Never trust a politician. Nor a Crooked Senator for that matter.
--   The Crooked Senator may seem</i> <i>like he has the village's best
--   interests at heart, but let's be honest, when put in a tough</i>
--   <i>situation he looks after no-one but himself. Even when safe, the
--   Crooked Senator may decide</i> <i>to toy with the Villagers' emotions
--   and try pit them against one another.</i>
--   
--   The Crooked Senator looks at the village votes as they come in.
crookedSenatorRole :: Role

-- | <i>How honoured we are to be in the presence of such a noble leader.
--   The return of the Druid</i> <i>marks an exceptional time in Fougères's
--   history! Friend of the woodland creatures, practiced</i>
--   <i>philosopher and now, with the help of Ferina their companion, a
--   bane to the Werewolves</i> <i>themselves! My does she have a nose on
--   her, strong enough to sniff out lycanthropes in close</i>
--   <i>proximity! Listen for her grunt and heed her warning for she will
--   not let you down.</i>
--   
--   Each morning when Ferina wakes from her slumber she will be alert and
--   cautious. If the Druid is next to a Werewolf in the player
--   <tt>circle</tt> then Ferina will grunt in warning.
druidRole :: Role

-- | <i>A skilled marksman with quick reflexes. In the unfortunate
--   situation that they are jumped and</i> <i>killed unjustly, they let
--   off a shot at their attacker, killing them instantly. The Hunter</i>
--   <i>never misses.</i>
--   
--   If the Hunter is killed they choose one player, believed to be an
--   attacker, to kill immediately.
hunterRole :: Role

-- | <i>Every village needs a Jester; they're so stupid, but provide so
--   much entertainment! The</i> <i>Jester may not have any special
--   abilities, but at least no-one in the village wants to hurt</i>
--   <i>them.</i>
--   
--   If the village votes to lynch the Jester, their identity is revealed.
--   The village realise there's no point in burning them and so they are
--   set free.
--   
--   The Jester continues to play but may no longer vote as no-one can take
--   them seriously.
jesterRole :: Role

-- | <i>Traditionally a Werewolf once transformed loses all memories and
--   personality. Over years of</i> <i>transforming, the Lycan has slowly
--   evolved and learnt how to retain themself. Night after</i> <i>night of
--   devouring with the other Werewolves took its toll. The screams alone
--   were enough to</i> <i>turn the Lycan and make them question their true
--   nature.</i>
--   
--   The Lycan is aligned with the Villagers, but appears to nature-seeing
--   roles (e.g., the Seer) as a Werewolf.
lycanRole :: Role

-- | <i>A beautiful flirt, the Medusa is aligned with the Villagers but
--   harbours a terrifying secret.</i> <i>During the day they are well
--   known in the village of Fougères for their stunning appearance</i>
--   <i>which captures the eye and love of all the townsfolk. However when
--   their secret takes ahold</i> <i>at sundown, their true self is
--   revealed. Any who gaze upon her true form would see live</i> <i>snakes
--   for hair and the few that further look into her eyes are turned to
--   stone.</i>
--   
--   If Medusa attracts the attention of a Werewolf during the night and is
--   devoured, the first Werewolf to their left in the player
--   <tt>circle</tt> will catch their gaze and turn to stone, instantly
--   killing the lupine predator.
medusaRole :: Role

-- | <i>Originally rejected by the townsfolk, the Oracle's prophetic
--   divinations has earned trust</i> <i>within the village. With constant
--   precognition - and concern for the future - the Oracle</i> <i>knows
--   the village will only live if they work together.</i>
--   
--   Each night the Oracle chooses a player to divine. They are then
--   informed of the player's role the following morning. This wisdom is
--   for the Oracle to use to ensure the future of Fougères.
oracleRole :: Role

-- | <i>The Protector is one of the few pure of heart and altruistic
--   Villagers; they are forever</i> <i>putting others needs above their
--   own. Each night they fight against the Werewolves with</i> <i>naught
--   but a sword and shield, potentially saving an innocents life.</i>
--   
--   Each night the Protector chooses a player deemed worthy of their
--   protection. That player is safe for that night (and only that night)
--   against the Werewolves.
--   
--   The Protector may not protect the same player two nights in a row.
protectorRole :: Role

-- | <i>The Saint, also historically known as a hallow, is recognized as
--   having an exceptional degree of</i> <i>holiness and likeness to God.
--   They are a humble Villager and shine light on these dark times.</i>
--   <i>Extinguishing this light would not be wise</i>
--   
--   If the Saint is lynched by the village, all who voted for them die.
saintRole :: Role

-- | <i>Werewolves don't just spring up out of the ground! That's where
--   dwarves come from. Clearly</i> <i>someone is to blame for this
--   affliction to Fougères. Unluckily for the Scapegoat, since</i>
--   <i>no-one actually knows who brought them here, the blame is always
--   laid upon them!</i>
--   
--   If the village's vote ends in a tie, it's the Scapegoat who is
--   eliminated instead of no-one.
--   
--   In this event, the Scapegoat has one last task to complete: they must
--   choose whom is permitted to vote or not on the next day.
scapegoatRole :: Role

-- | <i>The Seer has the ability to see into fellow townsfolk and determine
--   their true nature. This</i> <i>ability to see is not given out
--   lightly, for certain it is a gift! The visions will always be</i>
--   <i>true, but only for the present as not even the Seer knows what the
--   future holds.</i>
--   
--   Each night the Seer sees the allegiance of one player of their choice.
seerRole :: Role

-- | <i>A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even</i> <i>nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all</i> <i>the
--   Villagers in this unfortunate time.</i>
--   
--   The Simple Villager has no special abilities, they must use their
--   guile to determine whom among them is not who they say they are.
simpleVillagerRole :: Role

-- | <i>A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even</i> <i>nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all</i> <i>the
--   Villagers in this unfortunate time.</i>
--   
--   <i>Yet the Spiteful Villager has no loyalty in the afterlife; whoever
--   causes them harm may find</i> <i>themselves in trouble.</i>
--   
--   When the Spiteful Villager is killed, they are informed of everyone's
--   roles and may haunt the village as they wish.
spitefulVillagerRole :: Role

-- | <i>The True Villager has a heart and soul as clear as day! Their
--   allegiance and devotion to the</i> <i>village are beyond reproach. If
--   there is one person whom you should confide in, listen to and</i>
--   <i>trust, it is the True Villager.</i>
--   
--   At the start of the game the True Villager's identity is revealed.
trueVillagerRole :: Role

-- | <i>Somehow forgotten with the coming of the Werewolves, the Witch has
--   a chance to prove themself</i> <i>valuable to the village and maybe
--   abolish the absurd pastime of burning and drowning their</i> <i>cult.
--   The Witch is blessed (or maybe cursed) with the ability to make two
--   powerful potions;</i> <i>one of which heals a victim of the
--   Werewolves, the other poisons a player.</i>
--   
--   The Witch is called after the Werewolves. They are able to heal and
--   poison one player per game. There is no restriction on using both
--   potions in one night or on healing themself.
witchRole :: Role

-- | <i>The Alpha Wolf leads the Werewolves in the raids against Fougères
--   each night and not even the</i> <i>Seer can see them coming. If the
--   Werewolves caused the Villagers to question and accuse one</i>
--   <i>another beforehand, the Alpha Wolf eliminates any shred of humanity
--   left. No-one can be</i> <i>trusted anymore and no-one knows the
--   truth.</i>
--   
--   The Alpha Wolf appears to nature-seeing roles (e.g., the Seer) as a
--   Villager.
alphaWolfRole :: Role

-- | <i>The Simple Werewolf is a fearsome lupine, cunning like no other
--   creature that roams the</i> <i>forest. Their origin is unknown, but
--   that matters little, for they present a grave threat to</i>
--   <i>Fougères. While each day they hide in plain sight as an ordinary
--   Villager, each night they</i> <i>transform and devour an innocent.
--   There is little hope left for the village.</i>
--   
--   A Werewolf may never devour another Werewolf.
simpleWerewolfRole :: Role
instance GHC.Classes.Eq Game.Werewolf.Role.Role
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Role
instance GHC.Show.Show Game.Werewolf.Role.Role
instance GHC.Read.Read Game.Werewolf.Role.Role
instance GHC.Show.Show Game.Werewolf.Role.Activity
instance GHC.Read.Read Game.Werewolf.Role.Activity
instance GHC.Classes.Eq Game.Werewolf.Role.Activity
instance GHC.Show.Show Game.Werewolf.Role.Allegiance
instance GHC.Read.Read Game.Werewolf.Role.Allegiance
instance GHC.Classes.Eq Game.Werewolf.Role.Allegiance
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Allegiance
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Activity


-- | Variants alter how a game plays out. Either by changing the messages
--   returned, or by changing the game logic.
module Game.Werewolf.Variant

-- | Variant definitions require only a few pieces of information.
data Variant
tag :: Lens' Variant Text
name :: Lens' Variant Text
description :: Lens' Variant Text

-- | A list containing all the variants defined in this file.
allVariants :: [Variant]
standardVariant :: Variant
noRoleKnowledgeVariant :: Variant
noRoleKnowledgeOrRevealVariant :: Variant
noRoleRevealVariant :: Variant
spitefulVillageVariant :: Variant

-- | The traversal of <a>standard</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>standard</a> = <a>only</a> <a>standardVariant</a>
--   </pre>
standard :: Traversal' Variant ()

-- | The traversal of <a>noRoleKnowledge</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleKnowledge</a> = <a>only</a> <a>noRoleKnowledgeVariant</a>
--   </pre>
noRoleKnowledge :: Traversal' Variant ()

-- | The traversal of <a>noRoleKnowledgeOrReveal</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleKnowledgeOrReveal</a> = <a>only</a> <a>noRoleKnowledgeOrRevealVariant</a>
--   </pre>
noRoleKnowledgeOrReveal :: Traversal' Variant ()

-- | The traversal of <a>noRoleReveal</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleReveal</a> = <a>only</a> <a>noRoleRevealVariant</a>
--   </pre>
noRoleReveal :: Traversal' Variant ()

-- | The traversal of <a>spitefulVillage</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>spitefulVillage</a> = <a>only</a> <a>spitefulVillageVariant</a>
--   </pre>
spitefulVillage :: Traversal' Variant ()
instance Data.String.Humanise.Humanise Game.Werewolf.Variant.Variant
instance GHC.Show.Show Game.Werewolf.Variant.Variant
instance GHC.Read.Read Game.Werewolf.Variant.Variant
instance GHC.Classes.Eq Game.Werewolf.Variant.Variant


-- | Extra utility functions for working with lenses.
module Control.Lens.Extra

-- | The counter-part to <a>isn't</a>, but more general as it takes a
--   <a>Getting</a> instead.
--   
--   <pre>
--   <a>is</a> = <a>has</a>
--   </pre>
is :: Getting Any s a -> s -> Bool

-- | A re-write of <a>isn't</a> to be more general by taking a
--   <a>Getting</a> instead.
--   
--   <pre>
--   <a>isn't</a> = <a>hasn't</a>
--   </pre>
isn't :: Getting All s a -> s -> Bool

-- | Check to see if this <a>Fold</a> or <a>Traversal</a> matches 1 or more
--   entries in the current state.
--   
--   <pre>
--   <a>hasuse</a> = <a>gets</a> . <a>has</a>
--   </pre>
hasuse :: MonadState s m => Getting Any s a -> m Bool

-- | Check to see if this <a>Fold</a> or <a>Traversal</a> has no matches in
--   the current state.
--   
--   <pre>
--   <a>hasn'tuse</a> = <a>gets</a> . <a>hasn't</a>
--   </pre>
hasn'tuse :: MonadState s m => Getting All s a -> m Bool

-- | A companion to <a>filtered</a> that, rather than using a predicate,
--   filters on the given lens for matches.
filteredBy :: Eq b => Lens' a b -> b -> Traversal' a a


-- | Players are quite simple in themselves. They have a <a>name</a>,
--   <a>role</a> and <a>state</a>.
module Game.Werewolf.Player

-- | A player has a <a>name</a>, <a>role</a> and <a>state</a>. Any stateful
--   information needed for a player's <tt>role</tt> is held on the
--   <tt>Game</tt> itself.
--   
--   N.B., player equality is defined on just the <a>name</a>.
data Player
name :: Lens' Player Text
role :: Lens' Player Role
state :: Lens' Player State

-- | Surprise surprise, players may be <a>Dead</a> or <a>Alive</a>.
data State
Alive :: State
Dead :: State
_Alive :: Prism' State ()
_Dead :: Prism' State ()

-- | Creates a new <a>Alive</a> player.
newPlayer :: Text -> Role -> Player

-- | The traversal of <a>Player</a>s with an <a>alphaWolfRole</a>.
--   
--   <pre>
--   <a>alphaWolf</a> = <a>role</a> . <a>only</a> <a>alphaWolfRole</a>
--   </pre>
alphaWolf :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>beholderRole</a>.
--   
--   <pre>
--   <a>beholder</a> = <a>role</a> . <a>only</a> <a>beholderRole</a>
--   </pre>
beholder :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>crookedSenatorRole</a>.
--   
--   <pre>
--   <a>crookedSenator</a> = <a>role</a> . <a>only</a> <a>crookedSenatorRole</a>
--   </pre>
crookedSenator :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>druidRole</a>.
--   
--   <pre>
--   <a>druid</a> = <a>role</a> . <a>only</a> <a>druidRole</a>
--   </pre>
druid :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>dullahanRole</a>.
--   
--   <pre>
--   <a>dullahan</a> = <a>role</a> . <a>only</a> <a>dullahanRole</a>
--   </pre>
dullahan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>fallenAngelRole</a>.
--   
--   <pre>
--   <a>fallenAngel</a> = <a>role</a> . <a>only</a> <a>fallenAngelRole</a>
--   </pre>
fallenAngel :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>hunterRole</a>.
--   
--   <pre>
--   <a>hunter</a> = <a>role</a> . <a>only</a> <a>hunterRole</a>
--   </pre>
hunter :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>jesterRole</a>.
--   
--   <pre>
--   <a>jester</a> = <a>role</a> . <a>only</a> <a>jesterRole</a>
--   </pre>
jester :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>lycanRole</a>.
--   
--   <pre>
--   <a>lycan</a> = <a>role</a> . <a>only</a> <a>lycanRole</a>
--   </pre>
lycan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>medusaRole</a>.
--   
--   <pre>
--   <a>medusa</a> = <a>role</a> . <a>only</a> <a>medusaRole</a>
--   </pre>
medusa :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>necromancerRole</a>.
--   
--   <pre>
--   <a>necromancer</a> = <a>role</a> . <a>only</a> <a>necromancerRole</a>
--   </pre>
necromancer :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>oracleRole</a>.
--   
--   <pre>
--   <a>oracle</a> = <a>role</a> . <a>only</a> <a>oracleRole</a>
--   </pre>
oracle :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with an <a>orphanRole</a>.
--   
--   <pre>
--   <a>orphan</a> = <a>role</a> . <a>only</a> <a>orphanRole</a>
--   </pre>
orphan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>protectorRole</a>.
--   
--   <pre>
--   <a>protector</a> = <a>role</a> . <a>only</a> <a>protectorRole</a>
--   </pre>
protector :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>saintRole</a>.
--   
--   <pre>
--   <a>saint</a> = <a>role</a> . <a>only</a> <a>saintRole</a>
--   </pre>
saint :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>scapegoatRole</a>.
--   
--   <pre>
--   <a>scapegoat</a> = <a>role</a> . <a>only</a> <a>scapegoatRole</a>
--   </pre>
scapegoat :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>seerRole</a>.
--   
--   <pre>
--   <a>seer</a> = <a>role</a> . <a>only</a> <a>seerRole</a>
--   </pre>
seer :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>simpleVillagerRole</a>.
--   
--   <pre>
--   <a>simpleVillager</a> = <a>role</a> . <a>only</a> <a>simpleVillagerRole</a>
--   </pre>
simpleVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>simpleWerewolfRole</a>.
--   
--   <pre>
--   <a>simpleWerewolf</a> = <a>role</a> . <a>only</a> <a>simpleWerewolfRole</a>
--   </pre>
simpleWerewolf :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>spitefulVillagerRole</a>.
--   
--   <pre>
--   <a>spitefulVillager</a> = <a>role</a> . <a>only</a> <a>spitefulVillagerRole</a>
--   </pre>
spitefulVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>trueVillagerRole</a>.
--   
--   <pre>
--   <a>trueVillager</a> = <a>role</a> . <a>only</a> <a>trueVillagerRole</a>
--   </pre>
trueVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>villageDrunkRole</a>.
--   
--   <pre>
--   <a>villageDrunk</a> = <a>role</a> . <a>only</a> <a>villageDrunkRole</a>
--   </pre>
villageDrunk :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>witchRole</a>.
--   
--   <pre>
--   <a>witch</a> = <a>role</a> . <a>only</a> <a>witchRole</a>
--   </pre>
witch :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>zombieRole</a>.
--   
--   <pre>
--   <a>zombie</a> = <a>role</a> . <a>only</a> <a>zombieRole</a>
--   </pre>
zombie :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with <a>NoOne</a>.
--   
--   <pre>
--   <a>loner</a> = <a>role</a> . <a>allegiance</a> . <a>_NoOne</a>
--   </pre>
loner :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with the <a>Villagers</a>.
--   
--   <pre>
--   <a>villager</a> = <a>role</a> . <a>allegiance</a> . <a>_Villagers</a>
--   </pre>
villager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with the <a>Werewolves</a>.
--   
--   <pre>
--   <a>werewolf</a> = <a>role</a> . <a>allegiance</a> . <a>_Werewolves</a>
--   </pre>
werewolf :: Traversal' Player ()

-- | The traversal of <a>Player</a> names.
--   
--   <pre>
--   <a>names</a> = <a>traverse</a> . <a>name</a>
--   </pre>
names :: Traversable t => Traversal' (t Player) Text

-- | The traversal of <a>Player</a> roles.
--   
--   <pre>
--   <a>roles</a> = <a>traverse</a> . <a>role</a>
--   </pre>
roles :: Traversable t => Traversal' (t Player) Role

-- | The traversal of <a>Player</a> states.
--   
--   <pre>
--   <a>states</a> = <a>traverse</a> . <a>state</a>
--   </pre>
states :: Traversable t => Traversal' (t Player) State

-- | The traversal of <a>Player</a>s with the given name.
--   
--   <pre>
--   <a>named</a> name' = <a>filteredBy</a> . <a>name</a> name'
--   </pre>
named :: Text -> Traversal' Player Player

-- | The traversal of <a>alphaWolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>alphaWolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>alphaWolf</a>)
--   </pre>
alphaWolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>beholder</a> <a>Player</a>s.
--   
--   <pre>
--   <a>beholders</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>beholder</a>)
--   </pre>
beholders :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>crookedSenator</a> <a>Player</a>s.
--   
--   <pre>
--   <a>crookedSenators</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>crookedSenator</a>)
--   </pre>
crookedSenators :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>druid</a> <a>Player</a>s.
--   
--   <pre>
--   <a>druids</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>druid</a>)
--   </pre>
druids :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>dullahan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>dullahans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>dullahan</a>)
--   </pre>
dullahans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>fallenAngel</a> <a>Player</a>s.
--   
--   <pre>
--   <a>fallenAngels</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>fallenAngel</a>)
--   </pre>
fallenAngels :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>hunter</a> <a>Player</a>s.
--   
--   <pre>
--   <a>hunters</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>hunter</a>)
--   </pre>
hunters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>jester</a> <a>Player</a>s.
--   
--   <pre>
--   <a>jesters</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>jester</a>)
--   </pre>
jesters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>lycan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>lycans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>lycan</a>)
--   </pre>
lycans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>medusa</a> <a>Player</a>s.
--   
--   <pre>
--   <a>medusas</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>medusa</a>)
--   </pre>
medusas :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>necromancer</a> <a>Player</a>s.
--   
--   <pre>
--   <a>necromancers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>necromancer</a>)
--   </pre>
necromancers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>oracle</a> <a>Player</a>s.
--   
--   <pre>
--   <a>oracles</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>oracle</a>)
--   </pre>
oracles :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>orphan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>orphans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>orphan</a>)
--   </pre>
orphans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>protector</a> <a>Player</a>s.
--   
--   <pre>
--   <a>protectors</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>protector</a>)
--   </pre>
protectors :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>saint</a> <a>Player</a>s.
--   
--   <pre>
--   <a>saints</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>saint</a>)
--   </pre>
saints :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>scapegoat</a> <a>Player</a>s.
--   
--   <pre>
--   <a>scapegoats</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>scapegoat</a>)
--   </pre>
scapegoats :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>seer</a> <a>Player</a>s.
--   
--   <pre>
--   <a>seers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>seer</a>)
--   </pre>
seers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>simpleVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>simpleVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>simpleVillager</a>)
--   </pre>
simpleVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>simpleWerewolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>simpleWerewolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>simpleWerewolf</a>)
--   </pre>
simpleWerewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>spitefulVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>spitefulVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>spitefulVillager</a>)
--   </pre>
spitefulVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>trueVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>trueVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>trueVillager</a>)
--   </pre>
trueVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>villageDrunk</a> <a>Player</a>s.
--   
--   <pre>
--   <a>villageDrunks</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>villageDrunk</a>)
--   </pre>
villageDrunks :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>witch</a> <a>Player</a>s.
--   
--   <pre>
--   <a>witches</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>witch</a>)
--   </pre>
witches :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>zombie</a> <a>Player</a>s.
--   
--   <pre>
--   <a>zombies</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>zombie</a>)
--   </pre>
zombies :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>loner</a> <a>Player</a>s.
--   
--   <pre>
--   <a>loners</a> = <a>traverse</a> . <a>filtered</a> . (<a>is</a> <a>loner</a>)
--   </pre>
loners :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>villager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>villagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>villager</a>)
--   </pre>
villagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>werewolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>werewolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>werewolf</a>)
--   </pre>
werewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>Alive</a> <a>Player</a>s.
--   
--   <pre>
--   <a>alive</a> = <a>filtered</a> (<a>has</a> $ <a>state</a> . <a>_Alive</a>)
--   </pre>
alive :: Traversal' Player Player

-- | The traversal of <a>Dead</a> <a>Player</a>s.
--   
--   <pre>
--   <a>dead</a> = <a>filtered</a> (<a>has</a> $ <a>state</a> . <a>_Dead</a>)
--   </pre>
dead :: Traversal' Player Player
instance GHC.Classes.Eq Game.Werewolf.Player.Player
instance Data.String.Humanise.Humanise Game.Werewolf.Player.Player
instance GHC.Show.Show Game.Werewolf.Player.Player
instance GHC.Read.Read Game.Werewolf.Player.Player
instance GHC.Show.Show Game.Werewolf.Player.State
instance GHC.Read.Read Game.Werewolf.Player.State
instance GHC.Classes.Eq Game.Werewolf.Player.State


-- | A game is not quite as simple as players! Roughly speaking though,
--   this engine is <i>stateful</i>. The game state only changes when a
--   <i>command</i> is issued. Thus, this module defines the <a>Game</a>
--   data structure and any fields required to keep track of the current
--   state.
module Game.Werewolf.Game

-- | There are a few key pieces of information that a game always needs to
--   hold. These are:
--   
--   <ul>
--   <li>the <a>stage</a>,</li>
--   <li>the <a>round</a> number and</li>
--   <li>the <a>players</a>.</li>
--   </ul>
--   
--   Any further fields on the game are specific to one or more roles (and
--   their respective turns!). Some of the additional fields are reset each
--   round (e.g., the Seer's <a>see</a>) while others are kept around for
--   the whole game (e.g., the Orphan's <a>roleModel</a>).
data Game
variant :: Lens' Game Variant
stage :: Lens' Game Stage
round :: Lens' Game Int
players :: Lens' Game [Player]
boots :: Lens' Game (Map Text [Text])
chosenVoters :: Lens' Game [Text]
deadRaised :: Lens' Game Bool
divine :: Lens' Game (Maybe Text)
fallenAngelLynched :: Lens' Game Bool
healUsed :: Lens' Game Bool
hunterRetaliated :: Lens' Game Bool
jesterRevealed :: Lens' Game Bool
marks :: Lens' Game [Text]
passed :: Lens' Game Bool
poison :: Lens' Game (Maybe Text)
poisonUsed :: Lens' Game Bool
priorProtect :: Lens' Game (Maybe Text)
protect :: Lens' Game (Maybe Text)
roleModel :: Lens' Game (Maybe Text)
scapegoatBlamed :: Lens' Game Bool
see :: Lens' Game (Maybe Text)
votes :: Lens' Game (Map Text Text)

-- | Most of these are fairly self-explainable (the turn stages).
--   <a>Sunrise</a> and <a>Sunset</a> are provided as meaningful breaks
--   between the day and night as, for example, a <a>VillagesTurn</a> may
--   not always be available (curse that retched Scapegoat).
--   
--   Once the game reaches a turn stage, it requires a <i>command</i> to
--   help push it past. Often only certain roles and commands may be
--   performed at any given stage.
data Stage
DruidsTurn :: Stage
GameOver :: Stage
HuntersTurn1 :: Stage
HuntersTurn2 :: Stage
Lynching :: Stage
NecromancersTurn :: Stage
OraclesTurn :: Stage
OrphansTurn :: Stage
ProtectorsTurn :: Stage
ScapegoatsTurn :: Stage
SeersTurn :: Stage
Sunrise :: Stage
Sunset :: Stage
VillageDrunksTurn :: Stage
VillagesTurn :: Stage
WerewolvesTurn :: Stage
WitchsTurn :: Stage
_DruidsTurn :: Prism' Stage ()
_GameOver :: Prism' Stage ()
_HuntersTurn1 :: Prism' Stage ()
_HuntersTurn2 :: Prism' Stage ()
_Lynching :: Prism' Stage ()
_NecromancersTurn :: Prism' Stage ()
_OraclesTurn :: Prism' Stage ()
_OrphansTurn :: Prism' Stage ()
_ProtectorsTurn :: Prism' Stage ()
_ScapegoatsTurn :: Prism' Stage ()
_SeersTurn :: Prism' Stage ()
_Sunrise :: Prism' Stage ()
_Sunset :: Prism' Stage ()
_VillageDrunksTurn :: Prism' Stage ()
_VillagesTurn :: Prism' Stage ()
_WerewolvesTurn :: Prism' Stage ()
_WitchsTurn :: Prism' Stage ()
activity :: (Functor f, Contravariant f) => (Activity -> f Activity) -> Stage -> f Stage

-- | All of the <a>Stage</a>s in the order that they should occur.
allStages :: [Stage]

-- | An infinite cycle of all <a>Stage</a>s in the order that they should
--   occur.
stageCycle :: [Stage]

-- | Checks whether the stage is available for the given <a>Game</a>. Most
--   often this just involves checking if there is an applicable role
--   alive, but sometimes it is more complex.
--   
--   One of the more complex checks here is for the <a>VillagesTurn</a>. If
--   the Fallen Angel is in play, then the <a>VillagesTurn</a> is available
--   on the first day rather than only after the first night.
stageAvailable :: Game -> Stage -> Bool

-- | Creates a new <a>Game</a> with the given players. No validations are
--   performed here, those are left to the binary.
newGame :: Variant -> [Player] -> Game

-- | The traversal of the <a>votes</a> victim's name. This is the player,
--   if they exist, that received the majority of the votes. This could be
--   an empty list depending on whether the votes were in conflict.
votee :: Fold Game Player

-- | The traversal of the allowed voters during the <a>VillagesTurn</a> or
--   <a>WerewolvesTurn</a>. In a standard game, this is all <a>Alive</a>
--   players. However there are two scenarios for the <a>VillagesTurn</a>
--   that may change this:
--   
--   1) if the <a>scapegoat</a> has chosen some <a>chosenVoters</a>, it is
--   these players. 2) if the <a>jester</a> has been revealed, he may not
--   vote.
allowedVoters :: Fold Game Player

-- | The traversal of all <a>Alive</a> players that have yet to vote. This
--   is synonymous to <tt>voters - Map.keys votes</tt>
pendingVoters :: Fold Game Player

-- | The traversal of <a>Game</a>s on the first round.
firstRound :: Prism' Game Game

-- | The traversal of <a>Game</a>s on the second round.
secondRound :: Prism' Game Game

-- | The traversal of <a>Game</a>s on the third round.
thirdRound :: Prism' Game Game

-- | Gets all the <a>marks</a> in a game (which is names only) and maps
--   them to their player.
getMarks :: Game -> [Player]

-- | Queries whether anyone has won.
hasAnyoneWon :: Game -> Bool

-- | Queries whether the Dullahan has won. The Dullahan wins if they manage
--   to eliminate all their marks.
hasDullahanWon :: Game -> Bool

-- | Queries whether the Fallen Angel has won. The Fallen Angel wins if
--   they manage to get themselves lynched by the Villagers.
hasFallenAngelWon :: Game -> Bool

-- | Queries whether the Necromancer has won. The <a>Necromancer</a> wins
--   if they and their zombies are the only players surviving.
--   
--   N.B., the Jester is not considered when determining whether the
--   <a>Necromancer</a> has won.
hasNecromancerWon :: Game -> Bool

-- | Queries whether the <a>Villagers</a> have won. The <a>Villagers</a>
--   win if they are the only players surviving.
--   
--   N.B., the Dullahan and Fallen Angel are not considered when
--   determining whether the <a>Villagers</a> have won.
hasVillagersWon :: Game -> Bool

-- | Queries whether the <a>Werewolves</a> have won. The <a>Werewolves</a>
--   win if they are the only players surviving.
hasWerewolvesWon :: Game -> Bool

-- | Queries whether everyone has lost.
hasEveryoneLost :: Game -> Bool
instance GHC.Show.Show Game.Werewolf.Game.Game
instance GHC.Read.Read Game.Werewolf.Game.Game
instance GHC.Classes.Eq Game.Werewolf.Game.Game
instance GHC.Show.Show Game.Werewolf.Game.Stage
instance GHC.Read.Read Game.Werewolf.Game.Stage
instance GHC.Classes.Eq Game.Werewolf.Game.Stage
instance Data.String.Humanise.Humanise Game.Werewolf.Game.Stage


-- | Re-exports all of the public modules under <i>Game.Werewolf</i>. These
--   are:
--   
--   <ul>
--   <li><a>Game.Werewolf.Game</a></li>
--   <li><a>Game.Werewolf.Player</a></li>
--   <li><a>Game.Werewolf.Response</a></li>
--   <li><a>Game.Werewolf.Role</a></li>
--   <li><a>Game.Werewolf.Variant</a></li>
--   </ul>
--   
--   N.B., where clashes are found between <a>Game.Werewolf.Player</a>,
--   <a>Game.Werewolf.Role</a> and <a>Game.Werewolf.Variant</a>, the
--   <a>Game.Werewolf.Player</a> functions are preferred.
module Game.Werewolf
