File: BreakWhere.curry

package info (click to toggle)
curry-tools 1.0.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,492 kB
  • ctags: 121
  • sloc: makefile: 470; sh: 421
file content (20 lines) | stat: -rw-r--r-- 709 bytes parent folder | download
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")