Skip to content

Commit

Permalink
Refactor - Lenses for Ann in Oczor.Syntax.Types ptol#3
Browse files Browse the repository at this point in the history
  • Loading branch information
xgrommx committed Mar 28, 2017
1 parent 0170c07 commit 9416061
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Oczor/Compiler/Utl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Oczor/Infer/InferAst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/Oczor/Syntax/Ast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9416061

Please sign in to comment.