{"action":"created","issue":{"url":"https://api.github.com/repos/racket/typed-racket/issues/38","labels_url":"https://api.github.com/repos/racket/typed-racket/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/racket/typed-racket/issues/38/comments","events_url":"https://api.github.com/repos/racket/typed-racket/issues/38/events","html_url":"https://github.com/racket/typed-racket/issues/38","id":59580349,"number":38,"title":"Adding types to untyped values contracted with case-> via a type environment causes function application to fail","user":{"login":"lexi-lambda","id":759911,"avatar_url":"https://avatars.githubusercontent.com/u/759911?v=3","gravatar_id":"","url":"https://api.github.com/users/lexi-lambda","html_url":"https://github.com/lexi-lambda","followers_url":"https://api.github.com/users/lexi-lambda/followers","following_url":"https://api.github.com/users/lexi-lambda/following{/other_user}","gists_url":"https://api.github.com/users/lexi-lambda/gists{/gist_id}","starred_url":"https://api.github.com/users/lexi-lambda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lexi-lambda/subscriptions","organizations_url":"https://api.github.com/users/lexi-lambda/orgs","repos_url":"https://api.github.com/users/lexi-lambda/repos","events_url":"https://api.github.com/users/lexi-lambda/events{/privacy}","received_events_url":"https://api.github.com/users/lexi-lambda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-03T01:16:24Z","updated_at":"2015-03-03T22:12:51Z","closed_at":null,"body":"This simple program fails:\r\n\r\n```racket\r\n#lang racket\r\n\r\n(module untyped racket\r\n  (provide\r\n   (contract-out\r\n    [f (case-> (-> number? number? number?))]))\r\n  (define (f x y)\r\n    (expt x y)))\r\n\r\n(module type-env typed-racket/base-env/extra-env-lang\r\n  (require (submod \"..\" untyped))\r\n  (type-environment\r\n   [f (-> -Number -Number -Number)]))\r\n\r\n(module typed typed/racket\r\n  (require (submod \"..\" type-env))\r\n  (f 2 4))\r\n```\r\n\r\nIt generates the following error message, which I've been unable to comprehend.\r\n\r\n```\r\nType Checker: could not apply function;\r\n wrong number of arguments provided\r\n  expected: 2\r\n  given: 1 in: (#%plain-app provide/contract-id-f (quote 4))\r\n```\r\n\r\nI ran into this bug when attempting to use `typed/pict`, which provides functions that have `case->` contracts. For example, the following fails to compile:\r\n\r\n```racket\r\n#lang typed/racket\r\n(require typed/pict)\r\n \r\n(scale (circle 20) 2)\r\n```"},"comment":{"url":"https://api.github.com/repos/racket/typed-racket/issues/comments/77047933","html_url":"https://github.com/racket/typed-racket/issues/38#issuecomment-77047933","issue_url":"https://api.github.com/repos/racket/typed-racket/issues/38","id":77047933,"user":{"login":"rfindler","id":399024,"avatar_url":"https://avatars.githubusercontent.com/u/399024?v=3","gravatar_id":"","url":"https://api.github.com/users/rfindler","html_url":"https://github.com/rfindler","followers_url":"https://api.github.com/users/rfindler/followers","following_url":"https://api.github.com/users/rfindler/following{/other_user}","gists_url":"https://api.github.com/users/rfindler/gists{/gist_id}","starred_url":"https://api.github.com/users/rfindler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfindler/subscriptions","organizations_url":"https://api.github.com/users/rfindler/orgs","repos_url":"https://api.github.com/users/rfindler/repos","events_url":"https://api.github.com/users/rfindler/events{/privacy}","received_events_url":"https://api.github.com/users/rfindler/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T22:12:51Z","updated_at":"2015-03-03T22:12:51Z","body":"The arrow transformers are contracts that are statically known to be arrow\ncontracts and everything else (including possibly arrow contracts that are\nnot known to be arrows at compile time) is the other kind.\n\nAt a high level, the arrow transformers turn n-ary functions into n+1-ary\nfunctions where the extra argument is the blame object. This enables the\ncontract system to create the wrapper on the server side (not the client /\nrequire side) which means both less code and the chance for the racket\ncompiler to be more aggressive about inlining.\n\nIf you can make an example using only the contract library and not TR I can\ninvestigate more.\n\nRobby\n"}}