DenisFrezzato / hyper-ts

Type safe middleware architecture for HTTP servers
https://denisfrezzato.github.io/hyper-ts/
MIT License
391 stars 18 forks source link

fp-ts updated to v2 #19

Closed mlegenhausen closed 5 years ago

gcanti commented 5 years ago

Thanks @mlegenhausen, I'm working on an upgrade as well (branch 0.5.0). I was thinking of removing the class encoding, what do you think?

mlegenhausen commented 5 years ago

Absolutely! I would also like to port fp-ts-routing to classless because I use it in conjunction with hyper-ts.

mlegenhausen commented 5 years ago

@gcanti could you provide a 0.5.0-lib version? I would like to use it directly in my project.

gcanti commented 5 years ago

could you provide a 0.5.0-lib version?

done

I would also like to port fp-ts-routing to classless because I use it in conjunction with hyper-ts

Is there a problem with the current APIs?

mlegenhausen commented 5 years ago

@gcanti thanks I will try it out :)

Not a "problem" but having a mix of class and classless api is harder to read and understand for newcomers. I am planing to onboard a few of my team members with no FP experience (which is already hard) and giving them some patterns (use pipe) to work with fp-ts with a minimum amount of exceptions.

I think it would be enough to have the pipe operators available. So I can define routes like this

const home = pipe(
  M.lit('home')
  M.then(end)
)
const user = pipe(
  M.lit('user'),
  M.then(str('userId')),
  M.then(end)
)

const router: Parser<Location> = fold(getParserMonoid<Location>())([
  pipe(home.parser, P.map(...)),
  pipe(user.parser, P.map(...))
])
gcanti commented 5 years ago

Closing in favour of https://github.com/gcanti/hyper-ts/pull/21