Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Remove "where"? #189

Open
rtfeldman opened this issue Jul 29, 2013 · 2 comments
Open

Remove "where"? #189

rtfeldman opened this issue Jul 29, 2013 · 2 comments

Comments

@rtfeldman
Copy link
Collaborator

There was a mention in chat of the idea that where was on its way out. Personally I like the idea from a simplification standpoint, but separately, where is the only obstacle remaining before I can push removing let (in favor of just foo bar = baz with no let keyword needed).

Can we confirm the decision to drop where? If so, I can push removing both where and let.

@taku0
Copy link
Collaborator

taku0 commented Jul 29, 2013

Can we infer types of mutually recursive (possibly polymorphic) functions without where?

For example, is_even and is_odd below are mutually recursive functions having a type Number → Number while id is a polymorphic function having a type #a → #a.

let f x =
  is_even x
where
  is_even x = if id (x == 0) then true else is_odd (id (x - 1))
  is_odd x = if id (x == 0) then false else is_even (id (x - 1))
  id x = x

If we can, I don't oppose dropping where.

@puffnfresh
Copy link
Owner

Yeah, as @taku0 points out. This isn't just syntactic sugar. It provides a version of polymorphism that works with mutually recursive functions, written by @taku0.

I haven't ported it over to the constraint type system but I might now be able to make it work without the where keyword.

Not sure.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants