Commit b9997f60 authored by Michael Hanus 's avatar Michael Hanus
Browse files

UsageCheck adapted to changes in setfuncctions

parent 006c9bc5
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules --optF=-o #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Control.SetFunctions -- required by default rules
......@@ -8,7 +8,7 @@ import Test.Prop
-- equivalent to the standard one:
-- zip2 with default rule:
zip2 :: (Data a, Data b) => [a] -> [b] -> [(a,b)]
zip2 :: [a] -> [b] -> [(a,b)]
zip2 (x:xs) (y:ys) = (x,y) : zip2 xs ys
zip2'default _ _ = []
......
......@@ -8,7 +8,7 @@
--- See example program `Examples/UsageErrors.curry` for some examples.
---
--- @author Michael Hanus
--- @version December 2018
--- @version June 2021
---------------------------------------------------------------------------
module UsageCheck(checkSetUse, checkBlacklistUse) where
......@@ -50,14 +50,11 @@ setUse (_ ++
| not (validSetFunCall ct n args) = (qf,n)
--- Checks whether an application of a set function `setn` is as intended.
--- Note that the first `n` arguments are `Data` dictionaries.
validSetFunCall :: CombType -> String -> [Expr] -> Bool
validSetFunCall ct n args
| ct==FuncCall && all isDigit n && not (null args)
= if arity==0 then isFuncCall (head args)
else length args > arity &&
-- drop dictionary arguments:
isFuncPartCall arity (head (drop arity args))
else isFuncPartCall arity (head args)
where
arity = case readNat n of
[(i,"")] -> i
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment