default   Racket Bugs
Main PageQuick QueryStandard QueryAdvanced QueryHelp
Log in

View Problem Report: 12528

send email to interested parties or send email followup to audit-trail
Reporter's email: danburton dot email at gmail dot com
Number: 12528
Category: typed-scheme
Synopsis: Assign filters individually, rather than the negation of each other
Class: change-request
Responsible: samth
Notify-List:
Severity: serious
Priority: medium
State: closed
Confidential: no
Arrival-Date: Wed Feb 01 18:56:01 -0500 2012
Closed-Date: Tue Mar 25 22:54:29 -0400 2014
Last-Modified: Tue Mar 25 22:54:29 -0400 2014
Originator: Dan Burton
Organization: plt
Submitter-Id: unknown
Release: 5.1.3
Environment: linux-ubuntu
Description: I want to write something like this:

(: foo? (Any -> Boolean : Char | _))
(define (foo? x)
  (and (char? x)
       (char=? x #\c)))

Where the #t filter passes along the knowledge that the input is a Char, but the #f filter does *not* assert that x is *not* a Char. Currently, this is impossible, because current syntax couples the #t and #f filters, requiring them to be opposites.

To quote <stamourv> from irc:
This is expressible in the type system, but there's no syntax for it.
Basically, you'd like to give it filters for both the true and the false case
Or rather, you'd like to assign filters to each case individually, as opposed to one being the negation of the other.
I believe we could implement it.
As in, I don't see anything that would make it problematic, it's just a matter of adding it.
File Attachments:
How-To-Repeat:
Fix:
Release-Note:
Unformatted:

send email to interested parties or send email followup to audit-trail

Audit Trail:

From: Eric Dobson <eric.n.dobson at gmail.com>
To: samth at racket-lang.org, stamourv at racket-lang.org, bugs at racket-lang.org,
        danburton.email at gmail.com
Cc: 
Subject: Re: typed-scheme/12528: Assign filters individually, rather than the
 negation of each other
Date: Tue, 25 Mar 2014 19:51:36 -0700

 This has been fixed, the syntax is:
 
 #lang typed/racket
 
 (: foo? (Any -> Boolean : #:+ (Char @ 0)))
 (define (foo? x)
   (and (char? x)
        (char=? x #\c)))

State changed from "open" to "closed" by endobson at Tue, 25 Mar 2014 22:54:29 -0400
Reason>>> fixed.