module StateMonad where data ST a = S (Int -> (a, Int)) {-@ data ST a a -> Prop, p2 :: old:Int -> Int -> Prop> = S (x::(state:Int -> (a, Int))) @-} {-@ apply :: forall a a -> Prop, p2 :: old:Int -> Int -> Prop>. instate:(ST a) -> x:Int -> (a, Int) @-} apply :: ST a -> Int -> (a, Int) apply (S f) x = f x