Liam Goodacre

3K posts

Liam Goodacre banner
Liam Goodacre

Liam Goodacre

@goodacre_liam

Programmer, mainly Haskell, maybe categories. The answer is always an optic. Foldable Coyoneda gives me joy.

London, England Katılım Ocak 2008
450 Takip Edilen473 Takipçiler
Dad×3_jack
Dad×3_jack@Iceland_jack·
Simpler proof of (forall f. Functor f => f a -> f b) = (a -> b) (forall f. Functor f => f a -> f b) = (forall f. Functor f => ((a ->) ~> f) -> f b) = a -> b
English
1
0
4
699
Liam Goodacre
Liam Goodacre@goodacre_liam·
@Quelklef Your current setup looks contravariant - notice how you have `p s t -> p a b`, but profunctor optic libs have `p a b -> p s t`. I'd suggest using these data and mapping function types to have the best time:
Liam Goodacre tweet media
English
1
0
1
28
Maynard(, Eli)
Maynard(, Eli)@Quelklef·
if i gave it my full attention, how long would it take to understand all of the lens package? a month?
English
2
0
2
171
Liam Goodacre
Liam Goodacre@goodacre_liam·
@sjoerd_visscher It think it immediately felt odd because you have to pick a nesting `f ∘ g` or `g ∘ f`. (I've definitely also used this instance before). However, thinking it through a bit more, it's perhaps lining up with: foldMap t (Day f g abc) ~ foldMap t (abc <$> toList f <*> toList g)
English
1
0
1
55
Liam Goodacre
Liam Goodacre@goodacre_liam·
@sjoerd_visscher Yeah agreed, definitely not this zippy instance. Could do something like `(Applicative f, Foldable f, f ~ g) => Foldable (Day f g)`, or first collapse the Day to a Compose - but neither of those feel entirely sensible either.
English
1
0
1
60
Sjoerd 슕 Visscher
Sjoerd 슕 Visscher@sjoerd_visscher·
@goodacre_liam By the way, I see Day doesn't have a Foldable instance yet, but I think this wouldn't be the right one, it shouldn't be zippy.
English
1
0
0
42
effectfully
effectfully@effectfully·
Ranking Applicative functors from worst to best. Links in thread. F [Text.Regex.Applicative].RE (just use a monad, life is already hard without regexes) E [Control.Applicative].Lift (adds a "no effect" to an effect, barely ever useful) D [Control.Applicative].Backwards (traverse something right-to-left given a left-to-right traversal) C [Text.Earley].Prod (a classic algorithm with an applicative interface) [Control.Applicative].Free.Ap (can be useful for eDSLs) B Concurrently (concurrency is extremely useful, but you usually want it pooled, so only B tier) Validation (collect all errors instead of stopping at the very first one) Compose (a composition of applicatives is always applicative, quite wonderful) A Force f <*> ~a@(Force x) = Force $ a `seq` f x (this is from my force-elems challenge and it's beautiful) Sort (efficient applicative sorting is a feat) Phases (the generalization by @sjoerd_visscher and @Iceland_jack is really cool) Options.Applicative and YamlParse.Applicative and Data.Gather (parsing unordered things using a nice API can be very useful) S Const (gives you Getter stuff, easy S tier) Weave (pure delight) [Data.Functor.Rep].Co (Representable broke Edward Kmett and it doesn't get more impressive than that, so Co is officially the best Applicative. It's also a Monad, but it's the zippy Applicative that is the most interesting thing about it. Plus, zip-like functions occur a lot)
English
5
7
61
11.4K
Liam Goodacre
Liam Goodacre@goodacre_liam·
@runarorama @msimoni @cat_powered ( unsure how to fathom existential types being an escape of a type system; perhaps we have rather different things going on in our heads )
English
1
0
0
33
Rúnar
Rúnar@runarorama·
@msimoni @cat_powered Haskell has unsafeCoerce and existential types, so you can escape the type system all you want. I’ve had s need for this maybe twice in the past 20 years
English
2
0
9
509
Manuel Simoni
Manuel Simoni@msimoni·
What's often annoying about debating static type aficionados is that they argue as if static typechecking, unlike any other tool in existence, didn't come with a set of trade-offs.
English
18
2
68
30.7K
Taelin
Taelin@VictorTaelin·
Big breakthrough on SupGen today Up to this day, SupGen could only discover functions when given their type signatures. So, for a simple example, suppose you wanted to synthesize a multiplication algorithm for Peano Nats. Currently, the best you could do is type: ``` def add(x: Nat, y: Nat) -> Nat: ? def mul(x: Nat, y: Nat) -> Nat: ? assert mul(2n,3n) == 6n assert mul(3n,3n) == 9n assert mul(4n,1n) == 4n ``` Then save it to a file, and run Bend. The compiler would instantly auto-fill it for you with: - a correct addition algorithm - a correct multiplication algorithm At the same time - a seemingly small feat, yet that no other program miner / synthesizer was capable of accomplishing, so far. And it just works, like magic. But there is a catch: even though we didn't provide the 'add' algorithm, we had to provide its type signature. So, there is still some human-injected knowledge in this search, which acts as a hint. SupGen wasn't 100% autonomous. As of today, we're finally able to enumerate not just terms, but types. And the best part: enumerated types are first class, meaning we can use them anywhere in the code - even as the goal of some other enumeration! This means we can now type just: def aux = ? def mul(x: Nat, y: Nat) -> Nat: ? And SupGen will STILL find a correct mul() algorithm! Looks like a small change, but it is quite significant, since now the user doesn't need to know which aux functions might be needed to discover a given algorithm. SupGen is now more expressive, and capable of mining more complex algorithms on its own.
Taelin tweet media
English
12
17
280
25.2K
Tom Sydney Kerckhove
Tom Sydney Kerckhove@kerckhove_ts·
I don't mean to be too abstractly nonsensical, but does MonadIO really need a Monad constraint? Parser from opt-env-conf is only an applicative, but has runIO :: IO a -> Parser a.
English
1
0
2
284
Liam Goodacre
Liam Goodacre@goodacre_liam·
@Quelklef Something like this representation: `data Lens s t a b = Lens (s -> a) (b -> s -> t)` or even `data Lens s t a b = forall x . Lens (s -> (a, x)) ((b, x) -> t)` But not: `forall p . Strong p => p a b -> p s t` or: `forall f . Functor f => (a -> f b) -> (s -> f t)`
English
0
0
1
26
Liam Goodacre
Liam Goodacre@goodacre_liam·
@Quelklef Here's a few potential stages to go through with this. (Screenshot because it's too long for a single response).
Liam Goodacre tweet media
English
2
0
1
41
Maynard(, Eli)
Maynard(, Eli)@Quelklef·
@goodacre_liam by "explain the types" I mean like, literally be able to explain why a (using purescript-profunctor-lenses) `forall p. Strong p => p a b -> p s t` is able to get and set, what Strong has to do with anything, etc
English
1
0
2
111
Rick
Rick@rickasaurus·
Arguing with my 7yo daughter about if Mary Poppins is a witch or not, what do you think?
English
3
0
2
516
Oskar Wickström
Oskar Wickström@owickstrom·
free startup idea: LinkedIn, but you can't submit messages with newlines
English
1
0
5
717
Liam Goodacre
Liam Goodacre@goodacre_liam·
@rickasaurus I've never tried it, but i imagine you could freeze them, and defrost one by one; so they're more staggered.
English
1
0
1
25
Rick
Rick@rickasaurus·
Bananas are weird because you buy six, wait a few days because they’re inedible, and then scramble to eat them all in like 24 hours
English
1
0
2
250
Liam Goodacre
Liam Goodacre@goodacre_liam·
@AlgebraFact my intuition is that there are multiple well-defined exponential-like functions that we (confusingly) just so happen to use the same syntax/name for because they agree for the vast number of uses; but perhaps they ought to have different notation
English
0
0
1
93
effectfully
effectfully@effectfully·
Today after an hour of "the fuck can possibly be wrong here???" I found another bug in the Haskell compiler. Disabling already disabled warnings breaks basic code in the most cryptic way imaginable. Programmers do deserve this. It's divine punishment for making the rock think.
effectfully tweet media
English
6
11
277
9.3K