X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=afp%2Fa10%2Fa10.icl;h=9a44cd8348c258da3c2c0b9d1c86bd02fb194ea9;hb=95e99be6bdd04513688b88f1afaefac360eeff1d;hp=838f340620c69cdefad39022d62678f7a28c3720;hpb=e93ca347c979046dff47bdd1f12c582a6bf70cac;p=clean-tests.git diff --git a/afp/a10/a10.icl b/afp/a10/a10.icl index 838f340..9a44cd8 100644 --- a/afp/a10/a10.icl +++ b/afp/a10/a10.icl @@ -9,7 +9,12 @@ import Data.Maybe import Data.Error import Text => qualified join -:: BM a b = {t :: a->b, f :: b->a, t2 :: A.c t:(t c a)->t c b, f2 :: A.c t:(t b c)->t a c} +:: BM a b = + { t :: a->b + , f :: b->a + , t2 :: A.c t:(t c a)->t c b + , f2 :: A.c t:(t b c)->t a c + } bm = {t = id, f = id, t2 = id, f2 = id} :: Action b a @@ -78,6 +83,14 @@ eval (WhileContainerBelow _ action) s = eval (action :. whileContainerBelow action) s = pure s +opt :: (Action a b) -> Action a b +opt (WhileContainerBelow b a) = WhileContainerBelow b (opt a) +opt (Wait bm :. b) = opt (bm.f2 b) +opt (a :. Wait bm) = opt (bm.t2 a) +opt (a :. b) = opt a :. opt b +opt x = x + +Start = opt (moveToShip :. wait :. moveDown) //print :: (Action i f) [String] -> [String] //print (MoveToShip _ _) s = ["Move to ship":s] //print (MoveToQuay _ _) s = ["Move to quay":s]