diff --git a/Makefile_happysrcs b/Makefile_happysrcs index e04f458..291169f 100644 --- a/Makefile_happysrcs +++ b/Makefile_happysrcs @@ -5,7 +5,7 @@ ALEX = alex ALEX_OPTS = -g SRC = src -CABAL_BUILD = $(shell ./find-build.cl) +CABAL_BUILD = $(shell ./find-build.clj) all: parsers lexers diff --git a/find-build.cl b/find-build.cl deleted file mode 100755 index d755e7a..0000000 --- a/find-build.cl +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sbcl --script - -(let* ((paths (directory "dist-newstyle/build/*/*/rlp-*/build/")) - (n (length paths))) - (cond ((< 1 n) (error ">1 build directories found. run `cabal clean`.")) - ((< n 1) (error "no build directories found. this shouldn't happen lol")) - (t (format t "~A" (car paths))))) - diff --git a/find-build.clj b/find-build.clj new file mode 100755 index 0000000..d40a9fa --- /dev/null +++ b/find-build.clj @@ -0,0 +1,13 @@ +#!/usr/bin/env bb + +(defn die [& msgs] + (binding [*out* *err*] + (run! println msgs)) + (System/exit 1)) + +(let [paths (map str (fs/glob "." "dist-newstyle/build/*/*/rlp-*/build")) + n (count paths)] + (cond (< 1 n) (die ">1 build directories found. run `cabal clean`.") + (< n 1) (die "no build directories found. this shouldn't happen lol") + :else (-> (first paths) fs/real-path str println))) + diff --git a/rlp.cabal b/rlp.cabal index 584f4fb..6acf9d0 100644 --- a/rlp.cabal +++ b/rlp.cabal @@ -75,7 +75,6 @@ library , text >= 2.0.2 && < 2.3 , unordered-containers >= 0.2.20 && < 0.3 , recursion-schemes >= 5.2.2 && < 5.3 - , monadic-recursion-schemes , data-fix >= 0.3.2 && < 0.4 , utf8-string >= 1.0.2 && < 1.1 , extra >= 1.7.0 && <2 @@ -88,14 +87,8 @@ library , these >=0.2 && <2.0 , free >=5.2 , bifunctors >=5.2 - , blaze-html - , blaze-markup - , clay - , jmacro - , js-jquery - , aeson + , aeson >=2.2.1.0 && <2.3.1.0 , lens-aeson - -- , servant hs-source-dirs: src default-language: GHC2021 diff --git a/src/Core/SystemF.hs b/src/Core/SystemF.hs index 8180dbd..497c005 100644 --- a/src/Core/SystemF.hs +++ b/src/Core/SystemF.hs @@ -22,7 +22,7 @@ import Text.Printf import Control.Comonad import Control.Comonad.Cofree import Data.Fix -import Data.Functor +import Data.Functor hiding (unzip) import Control.Lens hiding ((:<)) import Control.Lens.Unsound diff --git a/src/Rlp/HindleyMilner.hs b/src/Rlp/HindleyMilner.hs index 0be2e93..656723a 100644 --- a/src/Rlp/HindleyMilner.hs +++ b/src/Rlp/HindleyMilner.hs @@ -37,7 +37,7 @@ import Data.Traversable import GHC.Generics (Generic, Generically(..)) import Debug.Trace -import Data.Functor +import Data.Functor hiding (unzip) import Data.Functor.Foldable hiding (fold) import Data.Fix hiding (cata, para) import Control.Comonad.Cofree @@ -121,6 +121,12 @@ generalise g t = ifoldr (\n _ s -> ForallT n s) t vs vs = H.difference (freeVariables t ^. hashMap) (g ^. contextTyVars) +instantiate :: Type PsName -> HM (Type PsName) +instantiate (ForallT x m) = do + tv <- freshTv + subst x tv <$> instantiate m +instantiate x = pure x + unify :: [Constraint] -> HM [(PsName, Type PsName)] unify [] = pure mempty diff --git a/src/Rlp2Core.hs b/src/Rlp2Core.hs index 9a3b3f2..7ef5b26 100644 --- a/src/Rlp2Core.hs +++ b/src/Rlp2Core.hs @@ -30,7 +30,6 @@ import Numeric import Data.Fix hiding (cata, para, cataM) import Data.Functor.Bind import Data.Functor.Foldable -import Data.Functor.Foldable.Monadic import Control.Comonad import Effectful.State.Static.Local @@ -103,11 +102,7 @@ typeToCore (VarT n) = TyVar n exprToCore :: (NameSupply :> es) => TypedRlpExpr PsName -> Eff es (Cofree (Core.ExprF Var) Core.Type) -exprToCore = cataM \case - t :<$ InL e -> pure $ t' :< annotateVar t' e - where t' = typeToCore t - -- InL e -> pure . annotateVars . Fix $ e - -- InR e -> rlpExprToCore e +exprToCore = undefined annotateVar :: Core.Type -> Core.ExprF PsName a -> Core.ExprF Var a