-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Decl -> FuncDecl; move out from Syntax.Common (#414)
* [refactor] Decl -> FuncDecl; move out from Syntax.Common * [refactor] TermDecl -> CoreFuncDecl
- Loading branch information
Showing
13 changed files
with
98 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{-# LANGUAGE QuantifiedConstraints, UndecidableInstances #-} | ||
|
||
module Brat.Syntax.FuncDecl where | ||
|
||
import Brat.FC (FC, WC) | ||
import Brat.Syntax.Abstractor (Abstractor) | ||
import Brat.Syntax.Common (Dir(..), Kind(..)) | ||
|
||
import Data.Kind (Type) | ||
import Data.List.NonEmpty (NonEmpty) | ||
|
||
data Locality = Extern (String, String) | Local deriving (Eq, Show) | ||
|
||
data FuncDecl (io :: Type) (body :: Type) = FuncDecl | ||
{ fnName :: String | ||
, fnSig :: io | ||
, fnBody :: body | ||
, fnLoc :: FC | ||
, fnLocality :: Locality | ||
} | ||
|
||
deriving instance | ||
forall tm io. | ||
(forall d k. Eq (tm d k), Eq io | ||
,Eq (FunBody tm Noun) | ||
,Eq (FunBody tm UVerb) | ||
) => Eq (FuncDecl io (FunBody tm Noun)) | ||
|
||
|
||
instance (Show io, Show (FunBody tm Noun)) | ||
=> Show (FuncDecl io (FunBody tm Noun)) where | ||
show FuncDecl{..} = unlines [fnName ++ " :: " ++ show fnSig | ||
,fnName ++ " = " ++ show fnBody] | ||
|
||
data FunBody (tm :: Dir -> Kind -> Type) (k :: Kind) where | ||
-- lhs and rhs | ||
ThunkOf :: WC (FunBody tm UVerb) -> FunBody tm Noun | ||
Clauses :: NonEmpty (WC Abstractor, WC (tm Chk Noun)) -> FunBody tm UVerb | ||
NoLhs :: (WC (tm Chk k)) -> FunBody tm k | ||
Undefined :: FunBody tm k | ||
|
||
deriving instance (forall d k. Show (tm d k)) => Show (FunBody tm k) | ||
deriving instance (forall d k. Eq (tm d k)) => Eq (FunBody tm k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.