packages feed

djinn-ghc 0.0.2.1 → 0.0.2.2

raw patch · 2 files changed

+20/−14 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

djinn-ghc.cabal view
@@ -1,5 +1,5 @@ name:           djinn-ghc-version:        0.0.2.1+version:        0.0.2.2 synopsis:       Generate Haskell code from a type. Bridge from Djinn to GHC API. description:    Djinn uses an theorem prover for intuitionistic propositional logic                 to generate a Haskell expression when given a type.
src/Djinn/GHC.hs view
@@ -108,18 +108,24 @@       envF = map (\(n,t) -> (toLJTSymbol n, D.hTypeToFormula tyEnv (hType t))) env       prfs = D.prove multi envF form       trms = map (D.hPrExpr . D.termToHExpr) prfs-  liftIO $ cropList trms microsec mx+  liftIO $ cropList trms microsec mx (\x -> lengthLessThan x 1000) -cropList :: [a] -> Int -> Int -> IO [a]-cropList _   _  0 = return []-cropList lst ms n = withAsync (let !l = lst in return l) $ \a -> do-                      threadDelay ms-                      res <- poll a-                      case res of-                        Just r -> case r of-                          Right (x:xs) -> do ys <- cropList xs ms (n-1)-                                             return $ x : ys-                          _            -> return []-                        Nothing -> do cancel a-                                      return []+cropList :: [a] -> Int -> Int -> (a -> Bool) -> IO [a]+cropList _   _  0 _ = return []+cropList lst ms n chk =+  withAsync (let !l = lst in return l) $ \a -> do+    threadDelay ms+    res <- poll a+    case res of+      Just r -> case r of+        Right (x:xs) -> if chk x then do ys <- cropList xs ms (n-1) chk+                                         return $ x : ys+                                 else return []+        _            -> return []+      Nothing -> do cancel a+                    return [] +lengthLessThan :: [a] -> Int -> Bool+lengthLessThan []     _ = True+lengthLessThan (_:_)  0 = False+lengthLessThan (x:xs) n = lengthLessThan xs (n-1)