Liam Goodacre
3K posts

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

@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:

English

@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

@goodacre_liam Going through Compose sounds right to me actually, why does it feel off to you?
English

@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

@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

@sjoerd_visscher Zip-a-dee-doo-dah, zip-a-dee-ay.
My, oh my, what a wonderful Day Convolution
English

@goodacre_liam This is so cool! And Daisy is very Daysy!
English
Liam Goodacre retweetledi

Hyperfunctions: Communicating continuations. ~ Donnacha Oisín Kidney, Nicolas Wu. doisinkidney.com/pdfs/hyperfunc… #Haskell #FunctionalProgramming
English

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

@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

@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

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.

English

@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

@goodacre_liam fuck yeah, thank you!
What do you mean by "data-represented"?
English

@Quelklef Here's a few potential stages to go through with this. (Screenshot because it's too long for a single response).

English

@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

@owickstrom @kerckhove_ts (Browser plugin that replaces all "<br>" with an actual br node).
English

@rickasaurus I've never tried it, but i imagine you could freeze them, and defrost one by one; so they're more staggered.
English

@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

Don’t Make Me Tap The Sign:
0^0 is Undefined
flyingcoloursmaths.co.uk/dmmtts-zero/
English








