1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
import Test.EasyCheck
-- The following task should be solved:
-- Break a Curry main expression into an expression and a where...free clause.
-- If the where clause is not present, the returned where-part is empty.
testExps = ["3+4","xs++ys =:= [1,2] where xs,ys free"]
-- FLP solution with default rules:
breakWhereFreeFLP (exp++wf@(" where "++_++" free")) = (exp,wf)
breakWhereFreeFLP'default exp = (exp,"")
main = map breakWhereFreeFLP testExps
test_without_where = breakWhereFreeFLP "3+4" -=- ("3+4",[])
test_with_where = breakWhereFreeFLP "xs++ys =:= [1,2] where xs,ys free"
-=- ("xs++ys =:= [1,2]"," where xs,ys free")
|