3data Access = LoggedOut | LoggedIn
4data LoginResult = OK | BadPassword
6interface DataStore (m : Type -> Type) where
7 data Store : Access -> Type
9 connect : ST m Var [add (Store LoggedOut)]
10 disconnect : (store : Var) -> ST m () [remove store (Store LoggedOut)]
12 readSecret : (store : Var) -> ST m String [store ::: Store LoggedIn]
13 login : (store : Var) ->
14 ST m LoginResult [store ::: Store LoggedOut :->
15 (\res => Store (case res of
17 BadPassword => LoggedOut))]
18 logout : (store : Var) ->
19 ST m () [store ::: Store LoggedIn :-> Store LoggedOut]
21getData : (ConsoleIO m, DataStore m) => ST m () []
22getData = do st <- connect
24 | BadPassword => do putStrLn "Failure"
26 secret <- readSecret st
27 putStrLn ("Secret is: " ++ show secret)
31-- badGet : DataStore m => ST m () []
32-- badGet = do st <- connect
33-- secret <- readSecret st
37 Store x = State String -- represents secret data
39 connect = do store <- new "Secret Data"
42 disconnect store = delete store
44 readSecret store = read store
46 login store = do putStr "Enter password: "
48 if p == "Mornington Crescent"
51 logout store = pure ()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list