packages feed

ecta-plugin 0.1.1.1 → 0.1.1.2

raw patch · 3 files changed

+20/−23 lines, 3 files

Files

ECTA/Plugin.hs view
@@ -148,6 +148,7 @@       let (scopeNode, anyArg, argNodes, skels, groups) =             let argNodes = ngnodes local_scope_comps                 addSyms st tt = map (Bi.bimap (Symbol . st) (tt . typeToFta))+                                . filter (\(_,t) -> isSafe t)                 gnodes = addSyms id (generalize global_scope_comps)                 ngnodes = addSyms id id                 anyArg = Node $ map (\(s,t) -> Edge s [t]) $ @@ -157,7 +158,8 @@                 groups = Map.fromList $ map (\(t,_) -> (t,[t])) scope_comps             in (scopeNode, anyArg, argNodes, skels, groups)       case typeToSkeleton ty of-         Just (t, cons) | resNode <- typeToFta t -> do+         Just (t, cons) | isSafe t,+                          resNode <- typeToFta t -> do              let res = getAllTerms $ refold $ reduceFully $ filterType scopeNode resNode              -- We ignore ppterms for now, because they need to be printed differently.              -- ppterms <- concatMapM (prettyMatch skels groups . prettyTerm ) res@@ -172,13 +174,10 @@                          f _ = Nothing                  filtered_fits = map (RawHoleFit . text . unpack . parIfReq) $                                  filter (not . flip Set.member fit_set) ecta_fits-                         -                 --                               return $ found_fits ++ filtered_fits-         _ ->  do liftIO $ putStrLn $  "Could not skeleton `" ++ showSDocUnsafe (ppr ty) ++"`"-                  return []+         _ ->  return found_fits+         -- liftIO $ putStrLn $  "Could not skeleton `" ++ showSDocUnsafe (ppr ty) ++"`"+         --          return []   -- TODO:
ECTA/Plugin/Utils.hs view
@@ -287,19 +287,17 @@         terms = case groups Map.!? t of                   Just r -> r                   _ -> groups Map.! (pack $ tail $ unpack t)-             -mtypeToFta :: TypeSkeleton -> Node-mtypeToFta (TVar "a"  ) = var1-mtypeToFta (TVar "b"  ) = var2-mtypeToFta (TVar "c"  ) = var3-mtypeToFta (TVar "d"  ) = var4-mtypeToFta (TVar "acc") = varAcc--- TODO: lift this restriction-mtypeToFta (TVar v) =-  error-    $ "Current implementation only supports function signatures with type variables a, b, c, d, and acc, but got "-    ++ show v-mtypeToFta (TFun  t1    t2      ) = arrowType (mtypeToFta t1) (mtypeToFta t2)-mtypeToFta (TCons "Fun" [t1, t2]) = arrowType (mtypeToFta t1) (mtypeToFta t2)-mtypeToFta (TCons s     ts      ) = mkDatatype s (map mtypeToFta ts)+-- | isSafe checks if we can use the type. Sadly ecta doesn't support all+-- types as of yet, so we fall back to the regulur valid hole-fits.+isSafe :: TypeSkeleton -> Bool+isSafe (TVar "a"  ) = True+isSafe (TVar "b"  ) = True+isSafe (TVar "c"  ) = True+isSafe (TVar "d"  ) = True+isSafe (TVar "acc") = True+-- We would like to remove this restriction, but ecta does not support it yet.+isSafe (TVar v) = False+isSafe (TFun  t1    t2      ) = isSafe t1 && isSafe t2+isSafe (TCons "Fun" [t1, t2]) = isSafe t1 && isSafe t2+isSafe (TCons s     ts      ) = all isSafe ts
ecta-plugin.cabal view
@@ -1,7 +1,7 @@ name: ecta-plugin cabal-version: 1.24 build-type: Simple-version: 0.1.1.1+version: 0.1.1.2 author: Matthías Páll Gissurarson maintainer: mpg@mpg.is synopsis: Hole-Fit Synthesis using ECTAs