« first day (768 days earlier)      last day (1098 days later) » 

00:00
Well I work in finance already, probably doesn't even require a change of jobs given what I do.
I thought you are a professor
I also work at a financial institution.
I didn't know that part
hmm...it's a rerun
gonna do something else...probably continue the new season of Genius
I'm trying to be an expert in several topics at the intersection of technology and finance.
So typeclasses are sort of the abstract base class, and instances are the concrete implementations...
I took notes pretty hard on this chapter, but it's been a while.
Looks like typeclasses also serve as mixins, so it's sort-of like a parent-child relationship, where parents are classes and children are instances. Man I don't like that usage of "instance" for what's semantically a subclass.
But I don't mind the constraint.
I think you shouldn't rely on OOP analogies too much. They will only get you so far in understanding FP concepts.
00:09
I could get used to it, in fact, I suppose.
Well, I'm living in an OOP world... :)
Plus I proposed a talk comparing Haskell to Python, so I've got to make all the comparisons.
A typeclass defines a set of functions that a given member of that type must implement. Some type classes will provide default implementations for some of the functions which rely on some fundamental building blocks. For example, a Comp class can provide an implementation of (>=) which relies on an instance that provides an implementation for (<).
"A typeclass defines a set of functions that a given member of that type must implement" - that's an ABC. "Some type classes will provide default implementations for some of the functions which rely on some fundamental building blocks." - that makes the ABC also a mixin.
okay...if that works for your mental model go for it!
Well I could be wrong, but I also think that's semantically correct.
Ord is a good example to start understanding type classes. A member of this type class must minimally define (<=) and all the other comparisons are provided for free
oh...and (==), I think, since Ord a must also fit the constraint Eq a.
00:15
I should probably bookmark this conversation - that's like @functools.total_ordering
@AaronHall the way you stated it definitely makes a lot of sense
> The Ord class is used for totally ordered datatypes.
yup
With any Haskell you write, you are already using type classes, even if you don't know it. Some of the fundamental ones include Num, Eq, Ord, and Show.
These are all probably a good place to start to at least understand what type classes are and how they are used even if you don't dig into the details of the implementations.
hmm...I should find some time to work through that tutorial. It's got some really good stuff. And Haskell is one of at least a dozen programming topics I am interested in.
not to mention the math I want to study
Yes, it's a great tutorial - plus it's free. Plus it's official.
Any language worth anything with regards to documentation should at least have an official tutorial.
I have no less than 3 books to finish reading, plus at least 2 programming projects to work on, and 3 or so math texts I want to study.
I have such a hard time picking one and focusing on it.
00:23
As Haskell is the quintessential functional language, I'm prioritizing it over other langs, and if you know me, you know I like to go deep.
my id: "ooh, venerable programming language"
my superego: "no, you're studying Haskell, remember?"
my ego: "yeah, but I've got to study Finance now..."
@copy feel free to weigh in!
@FélixGagnon-Grenier ditto to you!
I found typeclassopedia quite useful to understand some of the more advanced typeclasses
2
00:56
@copy that looks like a neat link.
 
15 hours later…
16:02
hello to everyone
 
2 hours later…
18:15
Hey all, anybody lurking?
18:55
@Dehodson lurk lurk
@EduardoHerrera hello!
@AaronHall A-ha! Caught you lurking.
lul
Reading the IO tutorial...when I'm not looking at this Python package I'm working on...
@AaronHall Just picking up Haskell?
Trying...
It's like my low priority fun-stuff - top priority language.
@AaronHall I'm a new-ish convert as well. It's really fun. Any part in particular you find difficult I could try to explain? I think I finally have IO down but I can't be certain :P
19:08
@Dehodson uh, sure. What's a monad?
19:20
ELI5 :)
@AaronHall You can think of a monad as a type of object that supports two operations specifically: "bind" and "return". In Haskell, "bind" is represented by the >>= operator. List and IO are two examples of monads.
hmmmmm
@AaronHall For instance, in python the "bind" operation would be coded as such: bind = lambda f, list: [item for sublist in map(f, list) for item in sublist]
(At least for lists)
@AaronHall LYAH explains monads pretty well. You should check it out =p
Those toons creep me out.
19:27
cover em up with duct tape
If you can't explain something, you don't really understand it. :P
yup, I don't really understand monads, so I'm not even attempting to explain them. I just know they are really cool, and I want to understand them better.
What's the best Prelude?
How many Preludes are there?
I only know of one
I think that's 16 different preludes listed above.
19:39
I've only ever used the default prelude that comes with GHC. I didn't even know there were more.
Top answer here counts 27: reddit.com/r/haskell/comments/4xjflq/…
well I think it's obvious that linked lists aren't the most efficient way to represent lists in a lot of contexts, and having text strings be linkedlists of characters is actually not so good.
20:03
@Dehodson Stealth lurker here :) Hi everyone!
@duplode welcome
@AaronHall Thanks!
@duplode so... what's a monad?
@AaronHall Here is an experimental take on explaining it...
First of all, a monad is a special kind of functor. Functorial values are values with a surrounding context...
For instance, [Integer] is an integer attached to other integers, and Maybe Integer is an integer that might turn out to be a missing value.
Monads are functors equipped with a way to change the surrounding context depending on the values within it.
Lemme whip up a little concrete example:
Let's say you have this function...
deleteIfNegative :: Integer -> Maybe Integer
deleteIfNegative x = if x < 0 then Just x else Nothing
If you pass `deleteIfNegative` to `(>>=)`, you end up with
(\mx -> mx >>= deleteIfNegative) :: Maybe Integer -> Maybe Integer
which changes Just into Nothing if there is a wrapped value which is negative.
(Is this explanation actually helpful?)
20:26
hm...
In category theory, a functor is a mapping from one set to another - while in Haskell, a functor is a type that can be mapped over. This seems to be a contradiction.
@AaronHall This can be a little subtle.
A functor is a mapping between categories.
Perhaps in Haskell they should have called these types "Functorable"
Haskell Functors are mappings from Hask (the category of Haskell types and functions) to Hask itself.
(That's why you'll sometimes hear it being said that Functors are Hask endofunctors.)
In a Functor instance, fmap maps the morphisms (i.e. Haskell functions), while the type constructor that gets the instance maps the objects (i.e. Haskell types).
So, while there is a little indirection involved, it is not wrong to say things like "Maybe is a functor". At worst, that is a mild metonym.
21:11
Is it correct to say that Maybe can be mapped?
how you doing
@AaronHall I suggest tweaking it slightly and saying "Maybe can be mapped over".
so, again, "Functor" should be "Functorable"
So is it actually, "a monad is a special kind of functorable"?
For instance, if you have something like fmap not (Just True), you are mapping a Bool -> Bool function to a Maybe Bool -> Maybe Bool one.
@AaronHall I'm not sure I'm getting the distinction. If "Functor" should be "Functorable", what should be the "Functor"?
To me, in the context of Haskell, to make it consistent with terminology from category theory, a functor is any function in Haskell.
21:24
@AaronHall Not quite, I'd say. Any function in Haskell is a morphism in the Hask category. What a Functor does with it is translating it, giving you a different function as the result.
To say a function is a functor, you'd have to point out which would be the source and target categories of the functor.
That would be the types of arguments and return value of the functions, which Haskell may infer or the user may explicitly give.
21:39
@AaronHall If the idea is taking a specific Haskell type as a category, the follow-up question would be what are the objects and morphisms in it.
ok, so, can a functor can have any degree of arity?
unary and binary functors exist. Would a nullary functor be a mapping of the empty set onto a single value?
@AaronHall What would be a binary functor in this context?
Googling "nullary functor" led me to gelisam.blogspot.com/2017/12/n-ary-functors.html , which suggests a notion of "nullary functor" in the same sense a Bifunctor would be a binary functor.
But I'm not sure if that's close to what you are thinking of.
21:57
@duplode A binary functor would take 2 arguments.
a ternary functor would take 3 arguments...
@AaronHall A Haskell Bifunctor takes two arguments, at type level.
(And a plain old Functor takes one argument at type level.)
Perhaps the matter here is the distinction between type level and value level?
Maybe so. I gotta run to a meetup, but I'll check back in as I can...
@AaronHall Okay, I will stick around. Have a good meetup :)
22:23
So...
22:37
@AaronHall Hask, the category in which Functors are endofunctors, has types as objects. Values lie, in a sense, one level of abstraction below.
It is possible to identify categories and functors both above and below it. When it comes to Functor, though, it is specifically a functor from Hask to Hask.
You might enjoy this Q&A about related matters:
23
Q: Where do values fit in Category of Hask?

AnkurSo we have Category of Hask, where: Types are the objects of the category Functions are the morphisms from object to object in the category. Similarly for Functor we have: a Type constructor as the mapping of objects from one category to another fmap for the mapping of morphisms from one ca...

The top three answers are all very nice.

« first day (768 days earlier)      last day (1098 days later) »