Modularised Prelude by garyb · Pull Request #41 · purescript/purescript-prelude · GitHub
Skip to content

Modularised Prelude#41

Closed
garyb wants to merge 1 commit into
masterfrom
modularised
Closed

Modularised Prelude#41
garyb wants to merge 1 commit into
masterfrom
modularised

Conversation

@garyb

@garyb garyb commented Sep 12, 2015

Copy link
Copy Markdown
Member

This is not for merging just yet, as this formulation has some changes that will have impact elsewhere:

The following modules are currently defined in purescript-control but sans the actual classes. I've merged them in here, so I guess if we did this we'd want to remove them from control? Either that or reverse the dependency and Prelude would become something more like an even more minimal base.

  • Data.Functor
  • Control.Apply
  • Control.Applicative
  • Control.Bind
  • Control.Monad

It seems like Data.Functor should belong in -functors now we have it, but that's not a great option without some work and dependency shuffling - it depends on tuples and foldable-traversable.

Other breaking changes we talked about:

  • Removed the return alias for pure
  • Removed the (++) alias for append

Some we didn't discuss, but seem worth considering:

  • Renamed liftM1 to just liftM. I guess if we were going to include higher arity versions then keeping the 1 would make sense alternatively.
  • Renamed the lift2...lift5 functions to liftAn to make them less ambiguous and to match liftA1.
  • Moved when and unless into Control.Applicative and relaxed the Monad constraint to Applicative.

Some non-breaking changes/enhancements:

  • Each Control module exports its Control dependencies, so if you import Applicative then you get Functor and associated operators in scope too.
  • Same for the number hierarchy
  • Added instances for functions in the style of (X b) => X (a -> b) as we had them on some classes and not others currently

There's a lot of stuff here, maybe we don't want any of it - that's fine, it was mainly to pass some time while on the road 😄

Comment thread src/Prelude.purs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, this works now? 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! You need to import qualified _ as _ though, import _ as _ doesn't work which perhaps should be added too.

@paf31

paf31 commented Sep 12, 2015

Copy link
Copy Markdown
Contributor

👍 Looks nice.

@garyb

garyb commented Sep 14, 2015

Copy link
Copy Markdown
Member Author

@garyb garyb closed this Dec 19, 2015
@garyb garyb deleted the modularised branch May 22, 2018 11:50
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