Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the module documentation's signature to HM type system #1218

Open
wei3hua2 opened this issue May 25, 2020 · 2 comments
Open

Improve the module documentation's signature to HM type system #1218

wei3hua2 opened this issue May 25, 2020 · 2 comments

Comments

@wei3hua2
Copy link

Documentation

Currently, the signature in the module documentation uses the javascript signature. This is harder to read compared to HM style type signature used by e.g. haskell, ramda.

https://gcanti.github.io/fp-ts/modules/

Current Behavior

example taken from https://gcanti.github.io/fp-ts/modules/IO.ts.html :

export declare const chain: <A, B>(f: (a: A) => IO<B>) => (ma: IO<A>) => IO<B>

Suggested Behavior

IO a -> (a -> IO b) -> IO b

@samhh
Copy link
Contributor

samhh commented Jun 9, 2020

I've been introducing fp-ts at work to a team including some only traditionally experienced with Java. So, not devs familiar with Haskell et al.

On the one hand, TypeScript's type signatures are horribly verbose and hard to read, and there's definitely room for improvement. I'm pleasantly surprised to see that Ramda has already done this.

On the other hand, this library and its documentation is already challenging to get to grips with for those less FP-acquainted. I've said "you should learn Haskell type signature syntax" to someone before when trying to explain monad binding to them, and, well, understandably, that feels like a bit of a bait and switch. It's like: here's this cool library so we can adopt FP in our TS codebase, oh but by the way you now need to go and learn a little Haskell to actually be able to understand how these type classes work.

I'm not really offering any sort of solution here, just another perspective. 🙂

@samhh
Copy link
Contributor

samhh commented Oct 28, 2020

Just to add that this suggestion might be better placed over in docs-ts which this repo uses for docs generation (same author).

On reflection I'd love if it could be toggled, defaulting to TypeScript syntax. I've seen that somewhere for side-by-sides of TypeScript and Haskell code but I can't recall where.

Edit: See below, I've raised it over there.

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

No branches or pull requests

2 participants