Comments (2)
On Thu, 22 Jan 2015 18:02:32 -0500, asumu at ccs dot neu dot edu wrote:
On 2015-01-22 17:40:02 -0500, [email protected] wrote:
*** Description:
(unless l
(error 'f ""))
(define &^%$ l) ;; comment this line out and it type-checks
l)
I don't have a fix for this, but I do have an explanation for why it
doesn't work.
Without the extra definition, the expansion looks something like this:
(define-values:4
(f)
(lambda:7
(l)
(if:8 l (#%app:8 void:8) (let-values:8 () (#%app:9 error 'f (quote ""))))
l))
which TR can deal with fine because the if
expression and l
come right
after each other in the function body.
With the extra definition, the expansion looks different:
(define-values:4
(f)
(lambda:7
(l)
(letrec-values
((()
(begin:13
(if:8
l
(#%app:8 void:8)
(let-values:8 () (#%app:14 error 'f (quote ""))))
(#%app:13 values:13)))
((&^%$) l))
l)))
In this case, the if
expression got stuck in a letrec-values
RHS.
The problem is that TR currently does not propagate the refinements from
the RHS to the point where the body is typechecked.
Cheers,
Asumu
from typed-racket.
On Thu, 22 Jan 2015 18:15:12 -0500, matthias at ccs dot neu dot edu wrote:
The workaround is this:
#lang typed/racket
(: f (-> (U False [Listof String]) [Listof String]))
(define (f l)
(unless l
(error 'f ""))
(g l))
(: g (-> [Listof String] [Listof String]))
(define (g l)
(define &^%$ l)
l)
On Jan 22, 2015, at 6:02 PM, Asumu Takikawa [email protected] wrote:
>> *** Description:
>> (unless l
>> (error 'f ""))
>> (define &^%$ l) ;; comment this line out and it type-checks
>> l)
> (define-values:4
> (f)
> (lambda:7
> (l)
> (if:8 l (#%app:8 void:8) (let-values:8 () (#%app:9 error 'f (quote ""))))
> l))
> (define-values:4
> (f)
> (lambda:7
> (l)
> (letrec-values
> ((()
> (begin:13
> (if:8
> l
> (#%app:8 void:8)
> (let-values:8 () (#%app:14 error 'f (quote ""))))
> (#%app:13 values:13)))
> ((&^%$) l))
> l)))
from typed-racket.
Related Issues (20)
- Examples of unexpected behavior for integer refinements
- `AnyValues` in `let/cc` is unbound.
- The `Nothing` type causes the type checker not to check the type. HOT 2
- struct #:mutable field option
- any-wrap: avoid wrapping immutable structs with immutable fields HOT 3
- Strange lack of subtyping for `case->` HOT 1
- Constructors in `typed/web-server/http` not provided
- Weird Error Message from `require/typed`
- apply < doesn't accept a non-empty list
- `check-eq? (hasheq) (hasheq)` fails HOT 4
- TR unsound with keyword args HOT 2
- `struct`'s `#:methods` missing in Typed Racket HOT 3
- The new hash match pattern doesn't work in Typed Racket
- type mismatch when using `Float`s with `for/sum` HOT 1
- `require/typed/provide` not providing constructors
- `require/typed` yields "unused require" warnings
- TR fails to typecheck when using optional arg and inline type specs
- treelists not supported in Typed Racket
- Can't use #:property to seal a Typed Racket structs
- `require/typed` duplicates effects from expanding `m`; docs unclear HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typed-racket.