Twitter | Search | |
Brandon Williams
Subterranean Homesick Mathematician. Texan. Functional Believer. Previously . Available for hire:
5,094
Tweets
356
Following
2,615
Followers
Tweets
Brandon Williams Jun 26
Replying to @bkase_ @runarorama
Ah yes, that would be the adjoint to the forgetful functor `Monoid -> Semigroup`, i.e. the free monoid over semigroups
Reply Retweet Like
Brandon Williams Jun 26
Replying to @bkase_
Whatdya mean? You can define free objects in terms of adjoints of forgetful functors… is that what you are referring to?
Reply Retweet Like
Brandon Williams Jun 26
Replying to @bkase_
Seems right to me!
Reply Retweet Like
Brandon Williams retweeted
Brandon Kase Jun 26
Free: Magma = Tree Semigroup = NonEmptyList Comm. Semigroup = NonEmptyMultiSet SemiLattice = NonEmptySet BoundedSemiLattice = Set
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
lol, one of the benefits of not having a job is tons of time for writing! Got a good one cooking now, maybe semiring will be next!
Reply Retweet Like
Brandon Williams Jun 26
Replying to @bkase_
Maybe I should file an issue on the PS repo. It prob doesn’t matter in practice, but def not technically correct
Reply Retweet Like
Brandon Williams Jun 26
Replying to @bkase_
Most of my intuition for these things comes from math where the free semiring is N[x], the polynomials on x with coefficients in N
Reply Retweet Like
Brandon Williams Jun 26
Replying to @bkase_
The free semiring would prob look more like MultiSet<List<A>>
Reply Retweet Like
Brandon Williams Jun 26
Replying to @bkase_
Lol that’s where I TIL’d this! HOWEVER, that is so NOT the free semiring. At best it’s the free near-semiring (which I learned about today)
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
…so queries dont compile when there’s a mismatch.
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
I’ve got a former colleague from grad school working on a postgres client in Haskell, the schema+queries are lifted to the type level…
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
totes! It’s kinda amazing to see what can be proven in idris and Haskell!
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
For example in idris you can write a type that express the idea of reversing an array at the type level. No need for a property test!
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
I do agree with the sentiment tho! The stronger the type system the fewer property tests!
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mdiep
Without type level programming and higher kinded types in swift there are sadly very few things you can model properly
Reply Retweet Like
Brandon Williams Jun 26
Replying to @stephencelis
Oops, correct link for this video:
Reply Retweet Like
Brandon Williams Jun 26
Replying to @johankj
shoot
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mbrandonw
…which allows you to express errors like: “name must be present AND contact info must be valid email OR valid phone number” for free!
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mbrandonw
…but TIL that if the error is a semiring, then you also get an alternative structure on the validation type…
Reply Retweet Like
Brandon Williams Jun 26
Replying to @mbrandonw
…that allows you to make a validation type that accumulates errors instead of just bailing on the first one (*ehem `try`*)…
Reply Retweet Like