Skip to content

Change transformation of string literals in patterns

Kai Prott requested to merge string-lits into master

Uses Data.=== on strings instead of both a case per list constructor of the string and a Data.=== on the individual characters. Reduces the size of the resulting flat curry programs and does not blow up quadratic like before.

test1 x = case x of 
  "Hello" -> 1
  "World" -> 2
-- transformed: 
test1 x = case rigid x === "Hello" of 
  True -> 1 
  False -> case rigid x === "World" of 
    True -> 2 
    False -> error "bleh"

test2 "Hello" = 1 
test2 "World" = 2 
test2 x = length x
-- transformed: 
test2 x = 
  (case flex x === "Hello" of True -> 1) ? 
  (case flex x === "World" of True -> 2) ? 
  (length x)

Merge request reports

Loading