Skip to content

Further update prelude docs#1018

Merged
garyb merged 1 commit intomasterfrom
prelude-again
Apr 2, 2015
Merged

Further update prelude docs#1018
garyb merged 1 commit intomasterfrom
prelude-again

Conversation

@garyb
Copy link
Copy Markdown
Member

@garyb garyb commented Mar 31, 2015

  • Expanded out the laws for Semiring, etc. into the same form we use elsewhere.
  • Dropped the do syntax alternatives for laws where they were used, as they weren't valid PureScript (used ; separators)
  • Rearranged stuff further to hopefully improve the flow

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 31, 2015

It also got me thinking about the orphan instances for Array again - we're pretty inconsistent about what's provided in Prelude. We have instances for Eq, Ord, Show, yet not for any of the Control stuff. Should we fix that?

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 31, 2015

Looks good.

I think the do notation is quite useful actually. I find the laws for Monad much easier to read that way, and I don't think it's hard to make the connection to valid do notation. I would like to support braces and semicolons anyway.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 31, 2015

For Array, I think I'd rather do things in the other direction, long term, even moving Array out of Prim and into purescript-arrays.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 31, 2015

Yeah, I did wonder about that. I guess that's a “Meltdown” change, as I assume it ties in with the removal or change in pattern matching and [] syntax that was/is being discussed.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 31, 2015

It would be nice to have some way of dealing with kind of flexible syntax for that kind of thing actually - it would also help with the int and char literal problem. OverloadedStrings in GHC isn't wonderful, but it's damn useful.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 31, 2015

some way of dealing with kind of flexible syntax

Templates?

myCharLiteral = [char|x]
myIntLiteral = [int|100]

Verbose, but very flexible.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 31, 2015

Yeah, I meant perhaps something less flexible so it would also be less verbose than just calling a char or int function. ;) Like the IsString stuff.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 31, 2015

Well one advantage of templates is that they can verify validity at compile time.

[char|actually a string] would give a compile time error.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 31, 2015

Ah, that's a good point.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 31, 2015

Tests failing as I misplaced (%) by accident it would seem. Should we remove it anyway, and promote purescript-integers for that usage?

garyb added a commit that referenced this pull request Apr 2, 2015
@garyb garyb merged commit ff577ab into master Apr 2, 2015
@garyb garyb deleted the prelude-again branch April 2, 2015 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants