Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-24 Thread Alexander D. Knauth
Also opaque types might help you: http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-24 Thread Stuart Hungerford
On Monday, 25 May 2015 02:43:58 UTC+10, Alex Knauth wrote: Also opaque types might help you: http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-23 Thread Alexander D. Knauth
As far as I know, this doesn’t exist in typed racket currently, but I’m wondering: (I’m thinking of seeing if I can implement this when I have time this summer) How should sub-typing interact with this? Should it be a completely separate type, not related by sub-typing at all, or should the

[racket-users] Typed racket equivalent of Haskell newtype?

2015-05-23 Thread Stuart Hungerford
Hi, Is there an idiomatic Typed Racket equivalent to the Haskell concept of newtypes? https://www.haskell.org/tutorial/moretypes.html That is, some way to have separate types that share a common structure? For example I'd like to define Radians and Degrees types that are both implemented as

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-23 Thread Matthias Felleisen
Stuart, would a predicated refinement type work for you: -- http://docs.racket-lang.org/ts-reference/special-forms.html?q=define-predicate#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._make-predicate%29%29 On May 23, 2015, at 6:14 PM, Alexander D. Knauth wrote: As far as I

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-23 Thread Stuart Hungerford
On Sunday, 24 May 2015 12:50:48 UTC+10, Matthias Felleisen wrote: Stuart, would a predicated refinement type work for you: -- http://docs.racket-lang.org/ts-reference/special-forms.html?q=define-predicate#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._make-predicate%29%29

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-23 Thread Stuart Hungerford
On Sunday, 24 May 2015 08:14:30 UTC+10, Alex Knauth wrote: As far as I know, this doesn’t exist in typed racket currently, but I’m wondering: (I’m thinking of seeing if I can implement this when I have time this summer) How should sub-typing interact with this? Should it be a