Proposal: Syntax extension

From: Michael Hanus <>
Date: Wed, 05 Jan 2011 10:51:18 +0100

Dear Colleagues,

I'd like to propose two slight syntax extensions to the current definition
of Curry that I found useful to make programs more readable
from my practical experiences.

1. Anonymous free variables: allow anonymous variables of the form "_"
   (underscore) in arbitrary expressions. Currently, anonymous variables
   are only allowed in patterns but not as free variables in right-hand
   sides or condition of rules. This has the drawback that they
   must be explicitly declared or one has to use the Prelude
   operation "unknown". Both is not nicely readable if one has
   several unknown arguments to some operation f:
    let a,b,c,d,e free in f x a b c d e
    f x unknown unknown unknown unknown unknown
   With the proposed extension, one can simply write "f x _ _ _ _ _"
   Thus, an occurrence of "_" in an expression is syntactic sugar
   for "let x free in x" (or the operation Prelude.unknown).

2. Non-linear patterns in function declarations: allow multiple occurences
   of a same variable in left-hand sides of function declarations.
   Such occurrences are syntactic sugar for equational constraints,
   i.e., a rule like "f x y (C x) = rhs" is syntactic sugar for
   "f x y (C z) | x=:=z = rhs" where z is a fresh variable.
   This extension avoids a restriction in Curry compared to logic programming.
   Moreover, the linearity condition does not make much sense
   in the light of other useful extensions like functional patterns.
   Finally, I don't see what is really gained by the linearity restriction.

I am interested to get some feedback on this proposal.

Best regards,

curry mailing list
Received on Mi Jan 05 2011 - 11:04:45 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:11 CEST