{-# LANGUAGE CPP #-} module RIO where #if __GLASGOW_HASKELL__ < 710 import Control.Applicative #endif -- THE REST OF THIS FILE IS SAFE; just adding this to trigger an error to appease the "neg" gods. {-@ silly_buggy_incr :: Nat -> Nat @-} silly_buggy_incr :: Int -> Int silly_buggy_incr x = x - 1 {-@ data RIO a
Bool, q :: World -> a -> World -> Bool> = RIO (rs :: (xxx:World
-> (a, World)<\w -> {v:World Bool, q :: World -> a -> World -> Bool>.
RIO a -> xyy:World -> (a, World)<\w -> {v:World |- World , w2::World a
-> (x:a b ;
>> :: forall < p :: World -> Bool
, p2 :: World -> Bool
, q1 :: World -> a -> World -> Bool
, q2 :: World -> b -> World -> Bool
, q :: World -> b -> World -> Bool>.
{x::a, w::World |- World , w2::World a
-> RIO b ;
return :: forall Bool>.
x:a -> RIO {w1:World | w0 == w1 && y == x}> a
@-}
(RIO g) >>= f = RIO $ \x -> case g x of {(y, s) -> (runState (f y)) s}
(RIO g) >> f = RIO $ \x -> case g x of {(y, s) -> (runState f ) s}
return w = RIO $ \x -> (w, x)
{-@ qualif Papp4(v:a, x:b, y:c, z:d, p:Pred a b c d) : papp4(p, v, x, y, z) @-}
-- Test Cases:
-- * TestM (Basic)
-- * TwiceM
-- * IfM
-- * WhileM
| true}>))
@-}
data RIO a = RIO {runState :: World -> (a, World)}
{-@ runState :: forall
| true}> @-}
data World = W
-- | RJ: Putting these in to get GHC 7.10 to not fuss
instance Functor RIO where
fmap = undefined
-- | RJ: Putting these in to get GHC 7.10 to not fuss
instance Applicative RIO where
pure = undefined
(<*>) = undefined
instance Monad RIO where
{-@ instance Monad RIO where
>>= :: forall < p :: World -> Bool
, p2 :: a -> World -> Bool
, r :: a -> Bool
, q1 :: World -> a -> World -> Bool
, q2 :: a -> World -> b -> World -> Bool
, q :: World -> b -> World -> Bool>.
{x::a
}
{x::a, w::World, w2::World
}
RIO