Really great talk from Daniela Petruzalek using generics to implement a #monad! #GopherConUK23 #GoLang
For example, memorizing the type signature that defines what a #monad is, even if you understand it perfectly would not teach you what a monad is (although it is a good first step).
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b
Learning what a monad is, means feeling a given feeling. And, this is why, there is no straightforward way to explain what a monad is. This is why everyone approaches it (explaining monads) differently and still no explanation is completely correct.
This is why for a layperson, reading a math textbook is often unnerving and unpleasant, in the same way as a child who never experienced romantic love, would find reading love stories (or any other book for grown-ups) unpleasant.
But once it "clicks" it suddenly makes sense - everyone knows that, but many don't realize that this clicking has nothing to do with memorization, it is just the experience of a feeling.
Reinstalled #LinuxMint on #Monad and got SiDock running on it on #BOINC... Ligands and protein folding or whatever vs. #COVID19, a worthy project. °°°Shall name Mother’s hand-me-down computer “COBOL”, it’s such a relic... I haven’t one common theme, of course. °°°
#linuxmint #monad #boinc #COVID19
I tried to model asynchronous exception masking-state and the safety of interruptible-actions explicitly on the #haskell #io #monad. How did I do?
https://gist.github.com/plredmond/b83479dc8a37130ea6810125fecd8032
I have a reference request related to #monad and #category theory. Suppose I have two different monads, S and T, on a category C. I know there are associated categories of S-algebras and T-algebras. Is there a reference that talks about objects that are algebras for *both* S and T? More specifically, my student is interested in constructing a monad, F, whose algebras are the "intersection" of S- and T-algebras.
An example would involve sets with two different algebraic operations, one governed by S and the other by T. We would like to know about sets that have *both* operations, with no condition on compatibility between them. If someone knows a simple and more specific example, I'd be happy to hear about that too.
My student has a neat construction of F for an application we have in mind, and it involves something like a colimit of (ST)^n. (But not exactly that, and I don't really want to say more about that if I don't have to.) I think someone must have thought about this kind of thing before in slightly more generality. Please let us know if you've heard of this kind of thing :)
I tried to write a Python program using Monad. Not sure a good way to do, though
I'm coding a statistical simulator, in which I need both of realized values and probability.
#monad #programming #statistics #python
Ever wanted to use #Rust to manipulate images like iterators?
image
.map(to_rgb)
.filter(|r, g, b| b > 100)
.collect();
Well, I don't quite have that, but I do have a #monadic-ish library called #obraztam.
https://framagit.org/dcz/obraztam
It's #immutable-first, it has .map() and .zip() and it optimizes to #SIMD instructions. Can be easily parallelized even more.
I used it to detect #laser beams in the picture!
#rust #monadic #obraztam #immutable #simd #laser #graphics #monad #iterator
https://www.youtube.com/watch?v=SN8nTQiWOYY&ab_channel=PBSSpaceTime
#Philosophy #PhilosophyOfScience #PhilosophyOfPhysics #PhilosophyOfCosmology #Science #Physics #Cosmology #Newton #Leibniz #Monad #Monads #Einstein #SpecialRelativity #GeneralRelativity #GR #Relativity #Spacetime #AbsoluteSpacetime #RelationalSpacetime #PBS #SpaceTime #PBSSpaceTime #MattOdowd
#mattodowd #pbsspacetime #pbs #relationalspacetime #absolutespacetime #spacetime #relativity #gr #generalrelativity #specialrelativity #einstein #monads #monad #leibniz #newton #cosmology #physics #science #PhilosophyOfCosmology #philosophyofphysics #philosophyofscience #philosophy #real #time #space
The Next 700 Programming Languages
(1966) : Landin, P. J.
DOI: https://doi.org/10.1145/365230.365257
#programming_language_theory #programming #monad #theory #paper #rule #calculus #parser #__printed #game #my_bibtex
#programming_language_theory #programming #monad #theory #paper #rule #calculus #parser #__printed #game #my_bibtex
@dabeaz I think that #Scheme `(set! var value)` is essentially the same as #Python `var=value` ... for a Python abstract interpreter (type analyzer) in #Prolog, I used something similar to #continuation-passing, but with 4 items in the continuations (some are lists, some are red-black trees; all are immutable) - these can be a bit of pain to manipulate but I used a #monad-like notation to simplify things. I presume that something similar could be done in #Haskell.
#haskell #monad #continuation #prolog #python #scheme
@wilfredh in #FunctionalProgramming the Result type is called a #monad. Implementing a monad in #TypeScript is simple enough, though there are plenty of FP libraries out there that provide these types out of the box.
There are many to choose from, this is one example https://gcanti.github.io/fp-ts/modules/Option.ts.html
#functionalprogramming #monad #typescript
Free Monad?
1.
#Functor 要支援 fmap
#Applicative 要支援 fmap|pure|<*>
#Monad 要支援 fmap|pure|<*>|>>=
可以看到越強的 typeclass,約束越大。
有沒有一個載體 M,可以讓你只有支援 fmap 的 Functor f。擺進去之後,M f 也可以有 Monad 的能力?
讓你的 Functor f,免費地(free) 獲得 Monad 的能力?
這個神祕的載體 M,就是 Free Monad。
2. 文章有提到一個 FreeMonad 的實作。是將 FreeMonad 以 List 遞迴的結構來建構。
`M f` 的 fmap|pure|>>=,可以只靠 (1) `M f` 本身的結構 加上 (2) f 的 fmap 來組裝起來。
3. 用到 M 的結構,來取代 f 要成爲 Monad 所需要的約束。
那麼你對 M f 的操作,都要繞一下 M 的結構,才能達到。 像是 Code 的 type 複雜度越來越複雜,後面的例子都看不懂了XD
#FP筆記 #Functor #Applicative #monad
Free Monad?
1.
#Functor 要支援 fmap
#Applicative 要支援 fmap|pure|<*>
#Monad 要支援 fmap|pure|<*>|>>=
可以看到越強的 typeclass,約束越大。
有沒有一個載體 M,可以讓你只有支援 fmap 的 Functor f。擺進去之後,M f 也可以有 Monad 的能力?
讓你的 Functor f,免費地(free) 獲得 Monad 的能力?
這個神祕的載體 M,就是 Free Monad。
2. 文章有提到一個 FreeMonad 的實作。是將 FreeMonad 以 List 遞迴的結構來建構。
`M f` 的 fmap|pure|>>=,可以只靠 (1) `M f` 本身的結構 加上 (2) f 的 fmap 來組裝起來。
3. 用到 M 的結構,來取代 f 要成爲 Monad 所需要的約束。
那麼你對 M f 的操作,都要繞一下 M 的結構,才能達到。 像是 Code 的 type 複雜度越來越複雜,後面的例子都看不懂了XD
#FP筆記 #Functor #Applicative #monad
Free Monad?
1. #Functor 要支援 fmap;
#Applicative 要支援 fmap|pure|<*>;
#Monad 要支援 fmap|pure|<*>|>>=。
可以看到越強的 typeclass,約束越大。
有沒有一個載體 M,可以讓你只有支援 fmap 的 Functor f。擺進去之後,M f 也可以有 Monad 的能力?
讓你的 Functor f,免費地(free) 獲得 Monad 的能力?
這個神祕的載體 M,就是 Free Monad。
2. 文章有提到一個 FreeMonad 的實作。是將 FreeMonad 以 List 遞迴的結構來建構。
`M f` 的 fmap|pure|>>=,可以只靠 (1) `M f` 本身的結構 加上 (2) f 的 fmap 來組裝起來。
3. 用到 M 的結構,來取代 f 要成爲 Monad 所需要的約束。
那麼你對 M f 的操作,都要繞一下 M 的結構,才能達到。 像是 Code 的 type 複雜度越來越複雜,後面的例子都看不懂了XD
#FP筆記 #Functor #Applicative #monad
I've been a professional #SoftwareEngineer for decades, and I still have no idea what a #Monad is.
Every time I try to read up, I seem to get descriptions that are highly abstract and confusing. It reminds me a bit of first learning what a "tensor" is... most people have very simple examples of tensors, but can't explain why it is a "thing" relative to other things.
Clearly "monad" solves a problem of some kind, but I haven't the foggiest idea what it is.
Please enlighten me. 😁