25 Apr 2024 |
zeroid | Alex, the "problem" is not GHC's (error) messages. The problem is that I am an analphabet with respect to its language. But ... I will and want to master this language. | 19:09:06 |
Alex | Yes, reading them takes some getting used to.
That will come with experience. | 19:09:29 |
zeroid | In reply to @alex:tunstall.xyz This comment about time-travelling is surprisingly fitting.
See http://web.archive.org/web/20190430061601/https://lukepalmer.wordpress.com/2008/08/10/mindfuck-the-reverse-state-monad/ Just opened the link. "Mindfuck: The Reverse State Monad" ??? Definitely something I will look into tomorrow. Thxs. | 19:15:41 |
Alex | In reply to @zeroidone:matrix.org Just opened the link. "Mindfuck: The Reverse State Monad" ??? Definitely something I will look into tomorrow. Thxs. If after reading it you find yourself in need of a more thorough explanation of how reverse state works, you may want to read this detailed blog post about time travelling state. | 19:22:01 |
geekosaur | https://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/ is another good one, although it's not about reverse state per se | 20:26:32 |
geekosaur | https://github.com/quchen/articles/blob/master/loeb-moeb.md is another fun one, if you're looking for "impossible" data/control flow | 21:19:53 |
zeroid | zeroid sends best greetings to geekosaur. | 22:01:46 |
| jecxjo changed their profile picture. | 22:38:40 |
| tzlil changed their profile picture. | 22:52:43 |
| rupalibangla_rahat joined the room. | 23:43:48 |
26 Apr 2024 |
Bowuigi | In reply to @zeroidone:matrix.org I am 63 years "old". When I play in ghci I feel like 16 or even younger (under 10). My Haskell-learning of today.
runState ((,) <$> (get >>= put . succ >> return "hello" ) <*> (get >>= put . negate >> return "applicative")) 3 I wish we've had Haskell when in school. 17yo here, having Haskell at a "school age" (didn't have Haskell at school) is pretty eye-opening. You can do crazy stuff with simple rules | 03:36:43 |
Bowuigi | The downside is that I dislike imperative and OOP langs now because I try to do functional stuff there and it doesn't work as intended lol | 03:37:38 |
Bowuigi | It also makes the first few years of uni (or similar) way easier, because you see a lot more patterns | 03:40:24 |
sm | smalltalk or self are the good OOP, like haskell is the good FP | 03:40:34 |
Bowuigi | Yeah, you can extend it to Ruby/Cristal perhaps, but they teach Java here | 03:41:20 |
Bowuigi | Well, my first year here (not a uni, I'm going for a "lower" degree and then maxing my curriculum to get a PhD quicker, I hope that works lol), we are learning Pascal so yeah, a breeze so far | 03:43:20 |
Bowuigi | Speaking about crazy stuff, messing around with catamorphisms, mutual recursion, church encoding, and the "list foldr lambda encoding" I managed to discover not just one, but an infinite family of lambda encodings that encode catamorphisms and mutual structural recursion efficiently. Sadly, single step (pattern matching / Scott style) can't be done on the recursive parts of the ADT | 03:45:28 |
Bowuigi | Apparently no one thought about that, which is weird because List seems to be the only datatype that was translated to that encoding | 03:50:08 |
ach | In reply to @bowuigi---now-more-based:kde.org The downside is that I dislike imperative and OOP langs now because I try to do functional stuff there and it doesn't work as intended lol I have had similar experiences. When I try to work with Java and other practical nonsense, I find myself swearing quite a bit and saying "with Haskell, all of this would be so easy". :-) | 03:59:41 |
irregularsphere | Highschooler here, having a "first glance" on functional programming (only tried Haskell). It looks great, could've been more popular ;) | 07:39:13 |
irregularsphere | * Highschooler here, having a "first glance" on functional programming (only tried Haskell). It looks great, could have had more recognition ;) | 07:42:40 |
irregularsphere | Redacted or Malformed Event | 07:47:57 |
irregularsphere | (well I guess it did have more recognition... not sure how but I guess that died out unfortunately) | 07:50:53 |
Alex | In reply to @bowuigi---now-more-based:kde.org Speaking about crazy stuff, messing around with catamorphisms, mutual recursion, church encoding, and the "list foldr lambda encoding" I managed to discover not just one, but an infinite family of lambda encodings that encode catamorphisms and mutual structural recursion efficiently. Sadly, single step (pattern matching / Scott style) can't be done on the recursive parts of the ADT Translating any covariant recursive data type is very straightforward: add a type argument t , replace any self-reference with t , then use a fixed point type constructor (e.g. Fix , Mu , or Nu ) to tie the knot.
This encoding always produces a Functor , which I'll call f . The catamorphism over f is of type forall a. Mu f -> (f a -> a) -> a and the anamorphism is of type forall a. (a -> f a) -> a -> Nu f . Other recursion schemes can be derived from these two (with hylomorphism-like ones requiring a partial Nu f -> Mu f function).
The type of foldr is equivalent to the catamorphism given by the above encoding.
The efficiency of this encoding is entirely dependant on the implementation of the lambda calculus. GHC struggles to optimise lambdas, so Fix tends to be faster than Mu and Nu .
Are you suggesting you've found a different encoding? | 09:40:35 |
| yajaru joined the room. | 10:41:08 |
MangoIV | https://arxiv.org/abs/2404.16062 Someone here asked. | 10:46:34 |
MangoIV | This is about parallel QC tests | 10:46:43 |
geekosaur | shapr ⬆️ | 11:02:11 |
geekosaur | * shapr, flip101 ⬆️ | 11:08:52 |
shapr | ooh, exciting | 12:02:40 |