[racket] Type of curry

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Sun Feb 24 17:59:45 EST 2013

Greetings,

Is the type of 'curry' correct?

#lang typed/racket

(: f2 (Boolean Integer Integer -> Integer))
(define (f2 add? i1 i2)
  (if add?
      (+ i1 i2)
      (- i1 i2)))

(define f1a (curry f2 #t)) ; fails to typecheck

(f2 #t 2 3)
(f2 #f 2 1)
;(f1a 10 20)

===>

Welcome to DrRacket, version 5.3.3 [3m].
Language: typed/racket; memory limit: 128 MB.
. Type Checker: Polymorphic function curry could not be applied to arguments:
Domains: (a b -> c)
         (a b -> c) a
Arguments: (Boolean Integer Integer -> Integer) True
 in: (curry f2 #t)
> 

It works fine when currying a two-argument function.

All the best,

Norman
(I'll resist any vindaloo jokes)


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK


Posted on the users mailing list.