Created
April 24, 2018 07:08
-
-
Save leodemoura/816b7a88ac60324077170c4b55758881 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
universes u v w | |
class monad_state' (σ : Type u) (m : Type u → Type v) := | |
(lift {} {α : Type u} : state σ α → m α) | |
section | |
variables {σ : Type u} {m : Type u → Type v} | |
instance ss' [s : monad_state σ m] : monad_state' σ m := | |
{lift := @monad_state.lift _ _ _} | |
@[inline] def get' (σ : Type u) {m : Type u → Type v} [monad m] [monad_state' σ m] : m σ := | |
monad_state'.lift state_t.get | |
end | |
def bistate_test : state_t ℕ (state_t bool io) unit := | |
do 0 ← get, -- outer state_t wins | |
tt ← get' bool, -- use the type to select the inner state | |
pure () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment