From 941606199d82fe93a374095e0de665a747d1b52e Mon Sep 17 00:00:00 2001 From: Denis Stoyanov Date: Tue, 28 Mar 2017 18:26:20 +0300 Subject: [PATCH] Refactor - Lenses for `Ann` in Oczor.Syntax.Types #3 --- src/Oczor/Compiler/Utl.hs | 2 +- src/Oczor/Infer/InferAst.hs | 2 +- src/Oczor/Syntax/Ast.hs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Oczor/Compiler/Utl.hs b/src/Oczor/Compiler/Utl.hs index 3831704..fe76443 100644 --- a/src/Oczor/Compiler/Utl.hs +++ b/src/Oczor/Compiler/Utl.hs @@ -56,7 +56,7 @@ inferAstTxt2 x = Parser.parseExpr x >>= (\y -> snd <$> inferAllExpr emptyContext inferContext :: InferContext -> ModuleName -> String -> Either Error InferContext inferContext context fileName x = fst <$> inferAllTxtWith context fileName x - + inferAllTxt :: String -> Either Error (InferContext, InferExpr) -- inferAllTxt x | traceArgs ["inferAllTxt", x] = undefined diff --git a/src/Oczor/Infer/InferAst.hs b/src/Oczor/Infer/InferAst.hs index 9d3a244..feeaa56 100644 --- a/src/Oczor/Infer/InferAst.hs +++ b/src/Oczor/Infer/InferAst.hs @@ -25,4 +25,4 @@ removeContext = cata $ \case instance Substitutable InferExpr where -- apply s | traceArgs ["apply inferExpr", show s] = undefined apply s = cata $ \case (AnnF ast (tp,ctx)) -> Ann (apply s ast) (apply s tp, apply s ctx) -- TODO FF (apply ast) - -- ftv = cata $ \case (AnnF ast tp) -> ftv tp + -- ftv = cata $ \case (AnnF ast tp) -> ftv tp diff --git a/src/Oczor/Syntax/Ast.hs b/src/Oczor/Syntax/Ast.hs index d76bd59..f08eea7 100644 --- a/src/Oczor/Syntax/Ast.hs +++ b/src/Oczor/Syntax/Ast.hs @@ -8,9 +8,9 @@ module Oczor.Syntax.Ast (module Oczor.Syntax.Ast, module Oczor.Syntax.Types, Lits(..), Stmts(..)) where import ClassyPrelude +import Control.Lens import Data.Functor.Foldable import Data.Functor.Foldable.TH -import Control.Lens import Oczor.Syntax.Types type ModuleName = [String] @@ -86,7 +86,7 @@ instance Functor f => Corecursive (Ann f a) where embed = \case AnnF f a -> Ann f a instance Show a => Show (Ann ExprF a) where - show (Ann x y) = "(" <> show x <> " ANN " <> show y <> ")" + show (Ann x y) = "(" ++ show x ++ " ANN " ++ show y ++ ")" stripAnns :: Ann ExprF a -> Expr stripAnns = cata $ embed . view unAnnF