Haskell is the epitome of many of the successes of strong type systems and some of the worst programming language decisions made.
This is an incredible breakdown of how GHC works. Absolutely worth learning if you want to learn more about the language, but I'm not sure to what degree it's worth spending time on now.
GitHub - thma/WhyHaskellMatters: In this article I try to explain why Haskell… is an overview of the language and why it matters.
Utilities
Hoogle
Search for programs using their type. This is the aspect of Haskell that's most appealing: with more information encoded into the type system - safety guarantees aside - we get far, far better program search and reuse - because our types generally express the functionality of the program! Being able to reuse code is incredibly nice for lots of reasons.
https://aaronguo1996.github.io/project/hoogleplus/ hoogle plus :: search for combinations of functions with hoogle! This is also at https://hoogleplus.goto.ucsd.edu/.
Simple Haskell
is a movement to program in only a simple, disciplined subset of the language, in order to build a robust foundation of beginner-friendly code that's easy to onboard programmers to without digging into the weeds of scary monads and typeclasses. Simple Haskell preludes exist to replace the default prelude, and the discipline usually recommends a set of language extensions to get everyone started.
Write Junior Code: A plea for Haskell developers to actually write code that people can understand and hire for. Boring Haskell Manifesto also describes this, as does Simple Haskell. It's very possible that more time has been spent pontificating about Haskell than actually writing production code in the service… My thoughts on Haskell in 2020 - Marco Sampellegrini.
Haskell mini-patterns handbook :: Kowainik: A book of Haskell design patterns. (I recall reading this on a particular lunch break out of the Skira office; the ideas sunk in at the time and could be applied to our class PL code. We should have used it).
There are many resources written with this practice in mind.
- Real World Haskell
- The golden rule of software quality : haskell
- GitHub - graninas/software-design-in-haskell: Software Design in Haskell. A s…
- Appendix to Software Design in Haskell · GitHub
- Type Classes: start learning haskell with good documentation, various inline demonstrations, and a book.
- haskell competency matrix: to identify where you're at with respect to your Haskell knowledge and figure out what you have left to learn.
- adventures in uncertainty: Towards Faster Iteration in Industrial Haskell
GHC
How Accursed and Unutterable is accursedUnutterablePerformIO? Creating GHC Rewrite rules Runtime Support for Multicore Haskell: a Retrospective | SIGPLAN Blog: On multicore Haskell. One of the biggest benefits of pure functional programming is parallel computation, so this better work well. Type Technology Tree : ezyang’s blog: How to consider different Haskell language extensions. What do they mean? How can they be applied? How do we determine when to use them? GHC.Generics: Datatype-generic functions that programmers can use and reuse, parameterizing them.
TemplateHaskell
backlinks
Macros
An excellent Template Haskell Tutorial, and another: https://github.com/leonidas/codeblog/blob/master/2011/2011-12-27-template-haskell.md
Interesting
GitHub - tathougies/hos: The functional Haskell kernel: a kernel for a Haskell operating system. (What?) Paweł Szulc - Maintainable Software Architecture in Haskell (with Polysemy) -… Hasktorch: A Comprehensive Haskell Library for Differentiable Functional Prog… Implementing Linear Haskell - YouTube Lambda calculus on the type level with GHC 7.11.20151212. · GitHub
Categories
Comonads | Bartosz Milewski's Programming Cafe Category theory https://ncatlab.org/nlab/show/comonad#definition Math Haskell and Category Theory Category theory Category Theory | Haskell Language Tutorial http://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html
Getting Started
Setting Up Stack
wget https://get.haskellstack.org/stable/linux-x86_64-static.tar.gz
rm -rf linux-x86_64-static.tar.gz
export PATH=$PATH:./s
Creating a project
creating project:
stack new Other simple
stack setup
getting ncurses5-compat-libs:
Proofs in Haskell?
- A casual guide to proving things in Haskell
- Dependent types in the context of Haskell (limited support)
- https://ucsd-progsys.github.io/liquidhaskell-blog/2020/04/12/polymorphic-perplexion.lhs/: Expression of orderings with haskell dependent types, via liquidhaskell.
- A more rigorous overview of dependently typed programming in Haskell
- Towards Tactic Metaprogramming in Haskell :: Reasonably Polymorphic
things to remake in haskell (and maybe racket!)
https://m.youtube.com/watch?v=FYTZkE5BZ-0 :: make music with haskell from scratch
etc
GitHub - davdar/parsing-with-derivatives-haskell: The original parsing with d…: Parsing with derivatives, as the parser maps to one! Very cool idea. Haskell for all: Introductions to advanced Haskell topics Locally Nameless djinn: Generate Haskell code from a type! With an associated blog post: Let’s play a game : ezyang’s blog. Conal Elliott » Blog Archive » “Everything is a function” in Haskell? linear algebra library implemented and experimented with in Haskell. accelerate: An embedded language for accelerated array processing:
Table of Contents
[2016-08-07]
.[2015-06-20]
Do notation expanded-
[[monads]] [[monad]]
- [[writer monad, logger monad]]
- [[reader monad]]
- [[state monad]]
[2015-06-20]
monad transformers [[monad]]- [[related]] [[fp]]
- [[Tweet from Dmitry Kovanikov (@ChShersh), at Jun 1, 04:37]] [[haskell]]
[2018-10-23]
krispo/awesome-haskell: A collection of awesome Haskell links, frameworks, libraries and software. Inspired by awesome projects line. [[haskell]][2018-11-24]
debug: what I learnt during setting app hakyll blog..[2019-01-06]
Resilient-Haskell-Software - Gwern.net [[haskell]][2019-02-11]
Stackage Server https://www.stackage.org/[2019-04-14]
debugging ghci[2019-01-05]
debug: stack trace[2019-01-25]
Henry de Valence on Twitter: "7 years ago i was very smart and wrote my website in haskell and now i can't update it because i forgot how to make a monad out of posts" / Twitter [[haskell]] [[fun]][2016-02-28]
applicative functors [[haskell]][2016-02-28]
monad vs applicative [[haskell]]
[2016-08-07]
.
ihaskell install
jupyter console –kernel haskell
[2015-06-20]
Do notation expanded
do e → e
do { e; stmts } → e >> do { stmts }
do { v <- e; stmts } → e >>= \v -> do { stmts }
do { let decls; stmts} → let decls in do { stmts }
This is not quite the whole story, since v might be a pattern instead of a variable. For example, one can write
do (x:xs) <- foo
bar x
but what happens if foo produces an empty list? Well, remember that ugly fail function in the Monad type class declaration? That’s what happens.
monads [[monad]]
writer monad, logger monad
-- l: log type, Monoid
newtype Writer l a = Writer {
runWriter :: (a, l)
}
reader monad
newtype Reader r a = Reader {
runReader :: r -> a
}
state monad
newtype State s a = State {
runState :: s -> (a, s)
}
[2015-06-20]
monad transformers [[monad]]
Monad transformers exist only because monads do not compose in general.
MaybeT : provides the construction for (f of Maybe) for any Monad f.
data Compose f g x = Compose (f (g x))
instance (Functor f, Functor g) => Functor (Compose f g) where
fmap f (Compose z) = Compose (fmap (fmap f) z)
instance (Monad f, Monad g) => Monad (Compose f g) where
bind :: Compose f g a -> (a -> Compose f g b) -> Compose f g b
bind (f (g x)) ff =
bind = ???
no way!
f a -> (a -> f b) -> f b
g c -> (c -> g d) -> g d
related [[fp]]
Tweet from Dmitry Kovanikov (@ChShersh), at Jun 1, 04:37 [[haskell]]
Looks like @iokasimov can write good #haskell jokes 😏
<https://twitter.com/ChShersh/status/1002393643288686592 >
[2018-10-23]
krispo/awesome-haskell: A collection of awesome Haskell links, frameworks, libraries and software. Inspired by awesome projects line. [[haskell]]
- State "DONE" from
[2019-04-22]
https://github.com/krispo/awesome-haskell
[2018-11-24]
debug: what I learnt during setting app hakyll blog..
- stack ghci
- Debug.Trace.traceShowM within do block
- pandoc –metadata
[2019-01-06]
Resilient-Haskell-Software - Gwern.net [[haskell]]
https://www.gwern.net/Resilient-Haskell-Software
[2019-02-11]
Stackage Server https://www.stackage.org/
[2019-04-14]
debugging ghci
stack ghci (module loaded automatically)
:set args rebuild
main
:break 222
[2019-01-05]
debug: stack trace
stack build --profile
stack exec -- site rebuild +RTS -xc
[2019-01-25]
Henry de Valence on Twitter: "7 years ago i was very smart and wrote my website in haskell and now i can't update it because i forgot how to make a monad out of posts" / Twitter [[haskell]] [[fun]]
<https://twitter.com/hdevalence/status/1088649294746275840 >
[2016-02-28]
applicative functors [[haskell]]
-
regular functor
class Functor f where fmap :: (a -> b) -> f a -> f b
Laws:
fmap id = id -- Identity
fmap (p . q) = (fmap p) . (fmap q) -- Homomorphism
-
applicative
class (Functor f) => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b
Laws:
pure id <*> v = v -- Identity
pure (.) <*> u <*> v <*> w = u <*> (v <*> w) -- Composition
pure f <*> pure x = pure (f x) -- Homomorphism
u <*> pure y = pure ($ y) <*> u -- Interchange
fmap f x = pure f <*> x -- Fmap
The mapping between Haskell functors is a family of functions parameterized by types. For instance, a mapping between the [] functor and the Maybe functor will map a list of a, [a] into Maybe a.
Here's an example of such a family of functions called safeHead:
safeHead :: [a] -> Maybe a
safeHead [] = Nothing
safeHead (x:xs) = Just x
[2016-02-28]
monad vs applicative [[haskell]]
https://wiki.haskell.org/Typeclassopedia#Intuition_3
Let’s look more closely at the type of (>>=). The basic intuition is that it combines two computations into one larger computation. The first argument, m a, is the first computation.
However, it would be boring if the second argument were just an m b; then there would be no way for the computations to interact with one another (actually, this is exactly the situation with Applicative).
So, the second argument to (>>=) has type a -> m b: a function of this type, given a result of the first computation, can produce a second computation to be run.
In other words, x >>= k is a computation which runs x, and then uses the result(s) of x to decide what computation to run second, using the output of the second computation as the result of the entire computation.
Actually, because Haskell allows general recursion, one can recursively construct infinite grammars, and hence Applicative (together with Alternative) is enough to parse any context-sensitive language with a finite alphabet.
http://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-languages-with-applicative
Here’s the key insight: normally, grammars are defined as finite objects: a finite set of terminals, a finite set of nonterminals, and a finite set of productions.
However, Haskell’s general recursion means that we can write down a "grammar" with an infinite set of production rules. This is what lets us get away with parsing context-sensitive languages with Applicative: we just make a different production rule for every possible input!
- public document at doc.anagora.org/haskell
- video call at meet.jit.si/haskell