HNHacker News
TopNewBestAskShowJobs

jhoxray

23 karma · joined September 2, 2021

Haskell, Type Theory and FP researcher
submissionscomments
jhoxray··on Building dependently typed FP language from scratch in Haskell
new tutorial with code and some interesting concepts / questions raised
jhoxray··on A Pure Types-Driven real-world apps development approach
There shouldn't be any, as the article is not behind the paywall?
jhoxray··on A Pure Types-Driven real-world apps development approach
very nice, thank you!
jhoxray··on A Pure Types-Driven real-world apps development approach
Thank you, and it is about Pi and Sigma types in the end, yes. The "Entity" would likely be Pi, and the "Database" - that takes variable number of Type parameters and generalizes type classes - would be Sigma.

"DatabaseContext" should provide a low-level API to the database we want to use, so that our "Entity" or "Database" pi/sigma types generate the same API for our pure types regardless of the underlying database. Using generics, default function implementations etc.

Actually, for single-table it is quite possible even now - we can design an Entity type family that would take care of storing / retreiving flat record types in SQL or Mongo using the same API. We'd still need to pass table names explicitly though (that's where Pi types would be useful), while specific db connection would be hidden inside a monad.

What we can't do - is model relationships elegantly by using function types ("Person -> [Post]" etc) - that's where the "Database" typeclass comes in.

jhoxray··on A Pure Types-Driven real-world apps development approach
Thank you, very good points!
jhoxray··on Do we need a platform like Medium, but with great support for Math and Code?
a bit too technical :)