-
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.
- Loading branch information
Showing
4 changed files
with
46 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{-# LANGUAGE BlockArguments #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE MultiParamTypeClasses #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
|
||
module Language.Dtfpl.Simplify.CheckNativeParams () where | ||
|
||
import Data.Foldable | ||
import Polysemy.Error | ||
|
||
import Language.Dtfpl.Err | ||
import Language.Dtfpl.Generate.Identifier | ||
import Language.Dtfpl.Simplify.SimplifyErr | ||
import Language.Dtfpl.Step | ||
import Language.Dtfpl.Syntax | ||
|
||
type instance StepEffs 'CheckedNativeParams = '[Error Err] | ||
|
||
instance Step Decl 'CheckedNativeParams where | ||
step def@(Def _ (T alts)) = do | ||
for_ alts \(A (DefAlt (T pats) _) _) -> | ||
for_ pats \pat -> case node pat of | ||
VarPat ib@(IdentBind (A (Ident s) _)) | ||
| identifierize s /= s -> | ||
throw $ SimplifyErr $ InvalidNativeArgErr ib | ||
_ -> pure () | ||
autoStep def | ||
step decl = autoStep decl |
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