packages feed

mulang-4.4.0: src/Language/Mulang/Inspector/Query.hs

module Language.Mulang.Inspector.Query (
  inspect,
  select,
  selectCount,
  Query) where

import Control.Monad (guard)

import Language.Mulang.Ast (Expression)

type Query a = [a]

inspect :: Query () -> Bool
inspect = not.null

select :: Bool -> Query ()
select = guard

selectCount :: (Int -> Bool) -> Query Expression -> Query ()
selectCount condition list = select (condition . length $ list)