We Turn our attention back to Haskell to help us get the best possible foundation for really diggin’ into functional programing. For me, only after doing piles of short examples, does it sink in for me, it’s the repetition and console output that is key.
Haskell for a greater Elm
The more Elm I do, the more I feel like I’m reading a story, and missed a chapter. There feels like some infered knowleadge, that I simply do not possess. Like you missed a key plot point in a movie, and you totally miss the big reveal!
You might be a very visual person. That’s awesome. I am not. I often here hear
in teaching, that get the students to get something, anything up on the DOM, as
soon as possible. This accomplishs a couple things. It gives them a sense of
accomplishment, which is great, sucesses, at every level should be celebrated,
but it also gives them some visual feedback, a thing,a tangable thing to look at
and manipulate. I am not that type of student. I would rather do 20 commandline
println "Hello World than a single visual output. And for me, the reason is
repitition. I need the quickest, shortest, black and white feedback. I don’t
want to switch applicaitons, I don’t even want to switch window focus. I want to
type out a thing, and as quickly as I can, get some regualr text feedback. Like
a println, or console.log, anything that does not require me to
- A way of categorizing values
- ‘a’ :: Char – this reads string ‘a’ has of type Char
- ’::’ is a type signature, this defines the type for that value, function, expression, whatever it might be.
- single quotes is a char, but double denotes a string. In JS, it doesn’t matter, the rule is to just be consistant. I feel like JS has given me the room, to either be really sloppy, or to express myself very well?
- String is a type alias. We use it as a convienance to refer to the actual
type. In this case, String is really [Char] a list of Char. We can also use
it to denote something like
- infix (++) & concat
- has the type of list of lists
- remember a string is just a list of char
- what’s foldable? [[a]], foldable instances of the Foldable typeclass, to come…
- if we concat a list of lists, it will simply flatten them into a single list
- in the below example _ everything to the right of the ‘::’ is strictly about
our types, not values _ the ‘a’ in the  is called a type variable _ it
does not know(i put cared here, but explicit knowleadge i think is more
appropriate) _ it simply doesn’t know, that that it doesn’t care _ it will
get a value for ‘a’ during the running of the program at some point, it
won’t always be a mystery, then it can be a concrete type like
[Char]_ bc the type signature is using
afor placeholder of the value to come, it is explicit that the list type must be the same
a == a* and the final
[a]of the 3 is the return type is also, surprise, a list of
Typeclasses provide definitions of operations, or fucntions, that can be shared across sets of types
λ :t (++) (++) :: [a] -> [a] -> [a] λ : concat concat :: Foldable t => t [a] -> [a]
- Boy, didn’t think I’d see you here. I first learned of you when programming
Objective-C polymorphism means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function
- Parametric polymorphism
- Parametric polymorphism refers to when the type of a value contains one or more (unconstrained) type variables, so that the value may adopt any type that results from substituting those variables with concrete types.
- Ad-hoc polymorphism
- Ad-hoc polymorphism refers to when a value is able to adopt any one of several types because it, or a value it uses, has been given a separate definition for each of those types.
- Parametric polymorphism
- Things you only get from working with a lang, like the implicit return from a
- These are hard to quanitify and communicate, they are rather picked up along the journey.
- where and let in Haskell introduce local binding to a name. Giving us the ability to reuse it with
- The Haskell Book
- The Joy of Haskell
- Reflecting on Haskell in 2017
- On Understanding Data Abstraction, Revisited