Go offline with the Player FM app!
62: Getting Haskell Programming in Types
Archived series ("Inactive feed" status)
When? This feed was archived on October 04, 2020 13:08 (). Last successful fetch was on January 04, 2020 14:08 ()
Why? Inactive feed status. Our servers were unable to retrieve a valid podcast feed for a sustained period.
What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.
Manage episode 223226197 series 1531971
Now on to programming with Types, Things are getting pretty good.
- Creating types with and | or
- Semigroups
- Parameterized Types
- The Maybe type
Algebraic data types: a composite type, meaning, any types that can be made by combining other types.
and / product types: combining two or more types, very common. nearly all languages have support for these. Structs in C. This can often be the only way to make new types.
This is the basis for class hierarchies. abstracting out what they have similar, and move downward. “real life is full of extreme edge cases”
Side note about data and declaring, or forming the data.
I really thought FP was function driven. But I’m not so sure I’d say that today. Yes yes functions as values are super important, but they more enable us to really focus on the structure and transformation of data, instead of actions or events on that data.
or / sum types: > In computer science, a tagged union, also called a variant, variant record, choice type, discriminated union, disjoint union, or sum type,
can take on several different, but fixed types. Like Bool
An instance of Bool can be either True or False
That Bool is a set containing all values True, False
Kinda like enums ? > An enumerated type can be seen as a degenerate case: a tagged union of unit types. It corresponds to a set of nullary constructors and may be implemented as a simple tag variable, since it holds no additional data besides the value of the tag.
- datatype tree = Leaf | Node of (int * tree * tree)
Composability: creating something new by combining two like things together.
Like concat 2 lists together.
HOF that’s just a ( . ) called compose
- it takes 2 functions for arguments example would be last item in a list last = head . reverse
Semigroup: type class with one important method the for combining instances that are of the same type.
() : : Semigroup a => a -> a -> a
takes a value of type a, we don’t care what it is. and another of the same type, and returns a value that is of the same type as a, whatever that was to begin with.
Guards: do some computation on the arguments that are going to be compared.
JavaScript to Elm
- Twitter: @jstoelm
- Email: jesse@jstoelm.com
Jesse Tomchak
- Twitter: @jtomchak
91 episodes
Archived series ("Inactive feed" status)
When? This feed was archived on October 04, 2020 13:08 (). Last successful fetch was on January 04, 2020 14:08 ()
Why? Inactive feed status. Our servers were unable to retrieve a valid podcast feed for a sustained period.
What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.
Manage episode 223226197 series 1531971
Now on to programming with Types, Things are getting pretty good.
- Creating types with and | or
- Semigroups
- Parameterized Types
- The Maybe type
Algebraic data types: a composite type, meaning, any types that can be made by combining other types.
and / product types: combining two or more types, very common. nearly all languages have support for these. Structs in C. This can often be the only way to make new types.
This is the basis for class hierarchies. abstracting out what they have similar, and move downward. “real life is full of extreme edge cases”
Side note about data and declaring, or forming the data.
I really thought FP was function driven. But I’m not so sure I’d say that today. Yes yes functions as values are super important, but they more enable us to really focus on the structure and transformation of data, instead of actions or events on that data.
or / sum types: > In computer science, a tagged union, also called a variant, variant record, choice type, discriminated union, disjoint union, or sum type,
can take on several different, but fixed types. Like Bool
An instance of Bool can be either True or False
That Bool is a set containing all values True, False
Kinda like enums ? > An enumerated type can be seen as a degenerate case: a tagged union of unit types. It corresponds to a set of nullary constructors and may be implemented as a simple tag variable, since it holds no additional data besides the value of the tag.
- datatype tree = Leaf | Node of (int * tree * tree)
Composability: creating something new by combining two like things together.
Like concat 2 lists together.
HOF that’s just a ( . ) called compose
- it takes 2 functions for arguments example would be last item in a list last = head . reverse
Semigroup: type class with one important method the for combining instances that are of the same type.
() : : Semigroup a => a -> a -> a
takes a value of type a, we don’t care what it is. and another of the same type, and returns a value that is of the same type as a, whatever that was to begin with.
Guards: do some computation on the arguments that are going to be compared.
JavaScript to Elm
- Twitter: @jstoelm
- Email: jesse@jstoelm.com
Jesse Tomchak
- Twitter: @jtomchak
91 episodes
All episodes
×Welcome to Player FM!
Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.