4 ms·
Brevity: class Monad m where (>>=) :: m a -> (a -> m b) -> m b Now, I am comfortable with upper case for type and lower case for instance. But m is an i
by smitty1e 5y ago
Brevity:
class Monad m where
(>>=) :: m a -> (a -> m b) -> m b
Now, I am comfortable with upper case for type and lower case for instance.
But m is an instance of a function, not a variable. But m, a, and b all look like variables. You are already hammering me with the brevity here.
Maybe put the functions in a serif font, and variables in a sans-serif? Or use different colors? Other languages seem to be more helpful with the visual cues.
Solving problems in SQL is a blast, so it seems like Haskell should be an easy lift, but the brevity of the syntax has sent me packing for years.
- dragonwriter 5y ago> Now, I am comfortable with upper case for type and lower case for instance. Monad is a typeclass, not a type. m is a variable, whose value is a type constructor. > But m is an instance of a function, not a variable. On the type level, m is a variable representing a type constructor; a concrete value it might have is List. It is an instance of a typeclass, not a function. > But m, a, and b all look like variables. m, a, and b are all type-level variables; the value of m is a type constructor (which is essentially a type-level function), while the values of a and b are types.
- smitty1e 5y agoMy point is that keeping all that straight at the single letter level is brutal. If it were a physical building, Haskell would be brutalist.
- bmn__ 5y ago> m, a, and b are all type-level variables; the value of m is a type constructor (which is essentially a type-level function), while the values of a and b are types. Let's try to apply that knowledge, and use my tribe's creed that "similar things should look similar, and different things should look different": -- α, β types -- m type constructor (>>=) :: m α -> (α -> m β) -> m β -- a, b types -- 𝘮 type constructor (>>=) :: 𝘮 a -> (a -> 𝘮 b) -> 𝘮 b I think that's much better. GP's complaint was correct, writing different concepts with the same notation is confusing.
- smitty1e 5y agoMay good fortune land all over you.
- loopz 5y agoThere's alot of unspoken assumptions, like what m usually means. The brevity is supposed to make higher concepts expressible however. Monad m is just a basic building block. It's hard to find best intro material. The above could scare away someone else, even Haskellers. Maybe intro on how to read examples, explanations etc. could aide?