From d7c0802c7f6219ccbde97e9aacba1c0e4bed49d4 Mon Sep 17 00:00:00 2001 From: Roman Leshchinskiy Date: Tue, 17 Jul 2007 05:15:27 +0000 Subject: [PATCH] Add fixV --- compiler/vectorise/VectMonad.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/vectorise/VectMonad.hs b/compiler/vectorise/VectMonad.hs index c6267a5..2e07697 100644 --- a/compiler/vectorise/VectMonad.hs +++ b/compiler/vectorise/VectMonad.hs @@ -2,7 +2,7 @@ module VectMonad ( Scope(..), VM, - noV, tryV, maybeV, orElseV, localV, closedV, initV, + noV, tryV, maybeV, orElseV, fixV, localV, closedV, initV, cloneName, newLocalVar, newTyVar, Builtins(..), paDictTyCon, @@ -201,6 +201,11 @@ maybeV p = maybe noV return =<< p orElseV :: VM a -> VM a -> VM a orElseV p q = maybe q return =<< tryV p +fixV :: (a -> VM a) -> VM a +fixV f = VM (\bi genv lenv -> fixDs $ \r -> runVM (f (unYes r)) bi genv lenv ) + where + unYes (Yes _ _ x) = x + localV :: VM a -> VM a localV p = do env <- readLEnv id -- 1.7.10.4