IdrisDoc
: Chapter.State
Index
Chapter.State
wrong
:
Int
->
ConsoleIO
GameState
treeLabelWith
:
Stream
labelType
->
Tree
a
->
(
Stream
labelType
,
Tree
(
labelType
,
a
)
)
treeLabel
:
Tree
a
->
Tree
(
Integer
,
a
)
testTree
:
Tree
String
setDifficulty
:
Int
->
GameState
->
GameState
runCommand
:
Stream
Int
->
GameState
->
Command
a
->
IO
(
a
,
Stream
Int
,
GameState
)
run
:
Fuel
->
Stream
Int
->
GameState
->
ConsoleIO
a
->
IO
(
Maybe
a
,
Stream
Int
,
GameState
)
readInput
:
(
prompt
:
String
) ->
Command
Input
randoms
:
Int
->
Stream
Int
quiz
:
ConsoleIO
GameState
labelWith
:
(
lbls
:
Stream
labelType
) -> (
vals
:
List
a
) ->
List
(
labelType
,
a
)
Attach labels from
lbls
to elements of
vals
.
lbls
A stream of labels.
vals
A list of values.
initState
:
GameState
forever
:
Fuel
flatten
:
Tree
a
->
List
a
correct
:
ConsoleIO
GameState
addWrong
:
GameState
->
GameState
addPositives
:
List
Integer
->
State
Integer
Nat
addIfPositive
:
Integer
->
State
Integer
Bool
addCorrect
:
GameState
->
GameState
data
Tree
:
Type
->
Type
Empty
:
Tree
a
Node
:
Tree
a
->
a
->
Tree
a
->
Tree
a
record
Score
MkScore
:
(
correct
:
Nat
) -> (
attempted
:
Nat
) ->
Score
correct
:
(
rec
:
Score
) ->
Nat
attempted
:
(
rec
:
Score
) ->
Nat
MkScore
:
(
correct
:
Nat
) -> (
attempted
:
Nat
) ->
Score
MkGameState
:
(
score
:
Score
) -> (
difficulty
:
Int
) ->
GameState
data
Input
:
Type
Answer
:
Int
->
Input
QuitCmd
:
Input
record
GameState
MkGameState
:
(
score
:
Score
) -> (
difficulty
:
Int
) ->
GameState
score
:
(
rec
:
GameState
) ->
Score
difficulty
:
(
rec
:
GameState
) ->
Int
data
Fuel
:
Type
Dry
:
Fuel
More
:
Lazy
Fuel
->
Fuel
data
ConsoleIO
:
Type
->
Type
Quit
:
a
->
ConsoleIO
a
Do
:
Command
a
-> (
a
->
Inf
(
ConsoleIO
b
)) ->
ConsoleIO
b
data
Command
:
Type
->
Type
PutStr
:
String
->
Command
()
GetLine
:
Command
String
GetRandom
:
Command
Int
GetGameState
:
Command
GameState
PutGameState
:
GameState
->
Command
()
Pure
:
ty
->
Command
ty
Bind
:
Command
a
-> (
a
->
Command
b
) ->
Command
b