module Kempe.Check.Lint ( lint ) where import Data.Foldable.Ext import Kempe.AST import Kempe.Error.Warning lint :: Declarations a b b -> Maybe (Warning b) lint :: Declarations a b b -> Maybe (Warning b) lint = (KempeDecl a b b -> Maybe (Warning b)) -> Declarations a b b -> Maybe (Warning b) forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Alternative f) => (a -> f b) -> t a -> f b foldMapAlternative KempeDecl a b b -> Maybe (Warning b) forall a b. KempeDecl a b b -> Maybe (Warning b) lintDecl lintDecl :: KempeDecl a b b -> Maybe (Warning b) lintDecl :: KempeDecl a b b -> Maybe (Warning b) lintDecl Export{} = Maybe (Warning b) forall a. Maybe a Nothing lintDecl TyDecl{} = Maybe (Warning b) forall a. Maybe a Nothing lintDecl ExtFnDecl{} = Maybe (Warning b) forall a. Maybe a Nothing lintDecl (FunDecl b _ Name b _ [KempeTy a] _ [KempeTy a] _ [Atom b b] as) = [Atom b b] -> Maybe (Warning b) forall b. [Atom b b] -> Maybe (Warning b) lintAtoms [Atom b b] as lintAtoms :: [Atom b b] -> Maybe (Warning b) lintAtoms :: [Atom b b] -> Maybe (Warning b) lintAtoms [] = Maybe (Warning b) forall a. Maybe a Nothing lintAtoms (a :: Atom b b a@(Dip b l [Atom b b] _):a' :: Atom b b a'@Dip{}:[Atom b b] _) = Warning b -> Maybe (Warning b) forall a. a -> Maybe a Just (b -> Atom b b -> Atom b b -> Warning b forall a. a -> Atom a a -> Atom a a -> Warning a DoubleDip b l Atom b b a Atom b b a') lintAtoms (Atom b b _:[Atom b b] as) = [Atom b b] -> Maybe (Warning b) forall b. [Atom b b] -> Maybe (Warning b) lintAtoms [Atom b b] as