r/purescript • • Oct 09 '19

What are the differences between Bounded Parametric Polymorphism and Ad Hoc Polymorphism?

8 Upvotes

For the longest time I've always associated ad hoc polymorphism with function overloading where the type that's passed in matters because the underlying implementation may be different.

I've associated parametric polymorphism with Generics in other languages as well as functions that can accept any type as the type truly does not matter with respect to how it's used.

However, whenever you place a constraint on a type, it seems to me that the type does matter in the sense that you've narrowed the scope as to what the type can be.

So, is it the case that with bounded parametric polymorphism that the type truly doesn't matter because the usage is going to be the same so long as it meets some constraint?

I'm probably thinking about this incorrectly and have some implicit assumption I'm making that's incorrect but I'm having trouble teasing it out. Let me know if I can clearer. I think the difference has to do with the underlying usage of the type and whether or not it's the same or has to change.

The question is how does bounded parametric polymorphism differ from ad hoc polymorphism?

Thanks in advance!

Edit: Thank you all for the replies! I've got a lot of thinking to do.


r/purescript • • Jun 13 '19

To mutate, or immutate, that is the question

Thumbnail
blog.logrocket.com
8 Upvotes

r/purescript • • Jan 28 '19

Beginner's guide

8 Upvotes

How does a person who hasn't done front end professionally (using html, css, javascript). But has some idea as to how webpages are made. Also knows why react is important and why it is so popular - How should that person start learning frontend programming using only purescript.

TL;DR -> Never used html css js and other js frameworks because it looked unstable and not scalable. How should I start with purescript to make good looking frontends.


r/purescript • • Jan 28 '19

List comprehensions with Applicative Functors

Thumbnail
medium.com
8 Upvotes

r/purescript • • Dec 04 '18

Nix-ify your Psc-Package dependencies, talk from Helsinki Haskell

Thumbnail
speakerdeck.com
8 Upvotes

r/purescript • • Nov 01 '18

Teamtavern.net - a client-server web app written in PureScript

Thumbnail
discourse.purescript.org
8 Upvotes

r/purescript • • Oct 10 '18

Use vim as purescript IDE

Thumbnail
spacevim.org
8 Upvotes

r/purescript • • Jul 17 '18

You've been using Monads

Thumbnail
medium.com
8 Upvotes

r/purescript • • May 13 '18

Interacting with the DOM in purescript-halogen

8 Upvotes

Hi. I'm writing a halogen-purescript component. I feel the documentation is very clear and the examples are good until I have to interact with the DOM. Then I feel things become very unclear. I'm aware of the fact that purescript-halogen is not a library for interacting with the DOM but I'm wondering how halogen developers usually go around this. I'm trying to get a value from the current selected list item.

SetSelected ev next -> do
  let event = mouseEventToEvent ev
  let elementFromEvent
        = hush
        <<< runExcept
        <<< readHTMLElement
        <<< toForeign
        <<< currentTarget
  element <- elementFromEvent event
  attr <- H.liftEff $ getAttribute "data-id" element

This tells me

Could not match type

  HTMLElement

with type

  Element

I have no idea how to go from HTMLElement to Element. I don't even know the difference really. Does one constantly have to make conversions like this when interacting with the DOM?


r/purescript • • May 10 '18

Parsing type-level strings to extract types - Qiita

Thumbnail
qiita.com
8 Upvotes

r/purescript • • Apr 21 '18

Optimizing Tagless Final

Thumbnail lukajcb.github.io
8 Upvotes

r/purescript • • Apr 14 '18

Easy Hot-Reloading PureScript with Parcel - Qiita

Thumbnail
qiita.com
8 Upvotes

r/purescript • • Mar 14 '18

WebGL in Purescript

8 Upvotes

Soon I will have to develop something that will probably need WebGL (plotting and manipulating 2D and 3D trajectories), and I would like to use Purescript for this. What is the current state of it? Do anybody has experiences to share?

By looking around I found the following packages:

What would be the go-to choice? What would be the most appropriate UI library to use with it?

Thank you!

EDIT: First link


r/purescript • • Jan 07 '18

Modified JSON parsing for free with PureScript-Simple-JSON - Qiita

Thumbnail
qiita.com
8 Upvotes

r/purescript • • Jan 06 '18

Opting in to better types and guarantees in PureScript - Qiita

Thumbnail
qiita.com
8 Upvotes

r/purescript • • Jan 04 '18

Optimizing Tagless Final Programs

Thumbnail lukajcb.github.io
8 Upvotes

r/purescript • • Dec 08 '17

Controlled Flow with PureScript-Bismuth - Qiita

Thumbnail
qiita.com
8 Upvotes

r/purescript • • Nov 25 '17

Replacing TypeScript: do we have tooling yet to turn .d.ts files into PureScript FFIs?

8 Upvotes

Just embarked on a little TS side project the other day to speed up the "day job" work done in VScode via custom extensions (such custom VScode plug-ins run as separate individual node.js processes btw.)

I don't mind TS in the slightest, but if there already were some existing tooling to get the very same "API" (type-defs-and-signatures) that TypeScript gets from VScode's *.d.ts files --- I'd quite prefer to do it in PureScript, for reasons of fun, productivity, extra correctness and terser code =)

But I don't see myself allocating time to write out the FFIs manually. Writing a *.d.ts to PS FFI/foreign.js "transpiler"/converter isn't impossible but might prove more intricate in practice than one would suspect at first glance.

So naturally I'm wondering whether anyone ever attacked this already! Or alternatively, have you heard of any VScode extensions coded in PureScript?


r/purescript • • Nov 21 '17

Record-based API Route-Handler pairing with Row Types - Qiita

Thumbnail
qiita.com
8 Upvotes

r/purescript • • Nov 16 '17

Intuition for Contravariant Functors?

8 Upvotes

Hey, so I sort of understand that contramap allows us to map over the input instead of the output of a function. I think that I'm just not putting two and two together because the type signature for contramap (contramap :: (b -> a) -> fa -> fb) confuses me and after a good day of googling I've not seen anything that really makes it click.

I suppose my question is, how does contramap use fa in conjunction with the function passed in (where b is the input), to produce an fb as output?

Thanks for your help!


r/purescript • • Oct 16 '17

Is Haskell the right language for teaching functional programming principles?

Thumbnail
profsjt.blogspot.com
8 Upvotes

r/purescript • • Sep 27 '17

Well-typed printfs cannot go wrong

Thumbnail kcsongor.github.io
8 Upvotes

r/purescript • • Sep 26 '17

"Unbox types with foldMap" is now up on Medium. Touches on generic programming too.

Thumbnail
medium.com
8 Upvotes

r/purescript • • Sep 26 '17

PureScript working on Raspberry Pi 3B

Thumbnail langintro.com
8 Upvotes

r/purescript • • Sep 07 '17

Multiway tree library inspired by Haskell's Data.Tree

Thumbnail
github.com
8 Upvotes