Used writegood suggestions
This commit is contained in:
parent
5758c55904
commit
e013898f2f
|
@ -4,12 +4,12 @@
|
|||
#+author: Yann Esposito
|
||||
#+EMAIL: yann@esposito.host
|
||||
#+keywords: Haskell, programming, functional, tutorial
|
||||
#+DESCRIPTION: A very dense introduction and Haskell tutorial. Brace yourself.
|
||||
#+DESCRIPTION: A dense introduction and Haskell tutorial. Brace yourself.
|
||||
#+OPTIONS: auto-id:t toc:t
|
||||
#+STARTUP: overview
|
||||
|
||||
#+begin_notes
|
||||
A very short and intense introduction to Haskell.
|
||||
A short and intense introduction to Haskell.
|
||||
|
||||
This is an update of my old (2012) article.
|
||||
A lot of things have changed since then.
|
||||
|
@ -24,45 +24,49 @@ This is why I wrote my old article.
|
|||
This is the end of 2019 and I still strongly believe that.
|
||||
I think you should at least be able to understand enough Haskell to write a
|
||||
simple tool.
|
||||
There are a few feature in Haskell that I really miss in most programming
|
||||
There are some features in Haskell that I really miss in most programming
|
||||
languages and that would not appear to be difficult to provide.
|
||||
Typically sum types.
|
||||
A concept so simple yet so helpful.
|
||||
|
||||
Since I wrote my article a few things have changed in the Haskell world.
|
||||
Since I wrote my article the Haskell ecosystem has evolved:
|
||||
|
||||
1. Project building has a few working solution. When I wrote this article I
|
||||
had a few web application that I can no longer build today.
|
||||
I mean, if I really want to invest some time, I'm sure I could make
|
||||
those project build again. But this is not worth the hassle.
|
||||
Now we have =stack=, =nix=, =cabal new-build= and I'm sure some other
|
||||
1. Project building has different existing solutions.
|
||||
When I wrote this article I made some web applications that I can no
|
||||
longer build today.
|
||||
I mean, if I really want to invest some time, I'm sure I could upgrade those
|
||||
projects to build again.
|
||||
But this is not worth the hassle.
|
||||
Now we have =stack=, =nix=, =cabal new-build= and I'm sure other
|
||||
solutions.
|
||||
2. GHC is able to do a lot more magic than then.
|
||||
This is beyond the scope of an introductory material in my opinion.
|
||||
But, while the learning curve is as steep as before the highest point of
|
||||
learning just jumped higher than before with each new GHC release.
|
||||
3. Still no real consencus about how to work, learn, and use Haskell. In my
|
||||
opinion there are three different perspective on Haskell that could
|
||||
definitively change how you make decisions about different aspect of
|
||||
Haskell programming. I believe the main groups of ideolgies are
|
||||
application developers, library developers and even language (mostly
|
||||
GHC) developers. I kind of find those tensions a proof of an healthy
|
||||
environment. There are different solutions to the same problems and that
|
||||
is perfectly fine. This is quite different when you compare to other
|
||||
language ecosystems where decisions are more controlled or enforced. I
|
||||
feel fine with both approaches. But you must understand that there is
|
||||
not really any central mindset within Haskeller unlike I can find in
|
||||
some other programming language communities.
|
||||
2. GHC is able to do a lot more magic.
|
||||
This is beyond the scope of an introduction material in my opinion.
|
||||
While the learning curve is as steep as before, the highest point of
|
||||
learning just climbed higher and higher with each successive new GHC release.
|
||||
3. Still no real consencus about how to work, learn, and use Haskell.
|
||||
In my opinion there are three different perspective on Haskell that
|
||||
could definitively change how you make decisions about different aspect
|
||||
of Haskell programming.
|
||||
I believe the main groups of ideolgies are application developers, library
|
||||
developers and the main compiler (GHC) developers.
|
||||
I find those tensions a proof of a healthy environment.
|
||||
There are different solutions to the same problems and that is perfectly
|
||||
fine.
|
||||
This is different when you compare to other language ecosystems where
|
||||
decisions are more controlled or enforced.
|
||||
I feel fine with both approaches.
|
||||
But you must understand that there is no central mindset within
|
||||
Haskellers
|
||||
unlike I can find in some other programming language communities.
|
||||
4. I think that Haskell is now perceived as a lot more serious programming
|
||||
language now.
|
||||
There are a lot more big projects written in Haskell not just toy
|
||||
A lot more big projects uses Haskell.
|
||||
Haskell proved its utility to write succesful complex entreprise
|
||||
projects.
|
||||
Thus Haskell as proved that it can be considered to write succesful
|
||||
complex entreprise projects.
|
||||
|
||||
While the ecosystem evolved I believe that I myself have certainly matured.
|
||||
Since 2013 I am paid to develop in Clojure.
|
||||
Most of my personal side project are written in Haskell or in an
|
||||
Since 2013 I'm paid to develop in Clojure.
|
||||
I write most of my personal side projects in Haskell or in some
|
||||
Haskell-inspired language.
|
||||
|
||||
As such I can follow two functional programming communities growth and
|
||||
|
@ -83,7 +87,7 @@ With just a very few amount of Haskell features you will already be in
|
|||
enviromnent with a *lot* of benefits as compared to many programming
|
||||
languages.
|
||||
|
||||
So enough talk, here is my old article updated with a few changes and
|
||||
So enough talk, here is my old article updated with a some changes and
|
||||
cleanups.
|
||||
I also added a section about how to create a new project template with nix.
|
||||
|
||||
|
@ -131,11 +135,11 @@ It is because it is hard that Haskell is interesting and rewarding.
|
|||
Today, I could not really provide a conventional path to learn Haskell.
|
||||
So I think the best I can do is point you to the [[https://www.haskell.org/documentation/][haskell.org]] documentation
|
||||
website.
|
||||
And you will see that most path involve a quite long learning process.
|
||||
And you will see that most path involve a long learning process.
|
||||
By that, I mean that you should read a long book and invest a lot of hours
|
||||
and certainly days before having a good idea about what Haskell is all about.
|
||||
|
||||
In contrast, this article is a very brief and dense overview of all
|
||||
In contrast, this article is a brief and dense overview of all
|
||||
major aspects of Haskell.
|
||||
I also added some information I lacked while I learned Haskell.
|
||||
|
||||
|
@ -151,7 +155,7 @@ The article contains five parts:
|
|||
|
||||
- *Dive into the impure*:
|
||||
|
||||
- Deal with IO; A very minimal example
|
||||
- Deal with IO; A minimal example
|
||||
- IO trick explained; the hidden detail I lacked to understand IO
|
||||
- Monads; incredible how we can generalize
|
||||
|
||||
|
@ -231,7 +235,7 @@ Congratulations you should be ready to start now.
|
|||
- =nix= is a generic package manager and goes beyond Haskell.
|
||||
One great good point is that it does not only manage Haskell packages but
|
||||
really a lot of other kind of packages.
|
||||
This can be quite helpful if you need to depends on a Haskell package that
|
||||
This can be helpful if you need to depends on a Haskell package that
|
||||
itself depends on a system library, for example =ncurses=.
|
||||
- I use [[http://nixos.org/nix][=nix=]] for other projects unrelated to Haskell.
|
||||
For example, I use the nix-shell bang pattern for shell script for which
|
||||
|
@ -368,14 +372,14 @@ Applying a function with the same parameters always returns the same value.
|
|||
|
||||
/Laziness/
|
||||
|
||||
Laziness by default is a very uncommon language design.
|
||||
Laziness by default is an uncommon language design.
|
||||
By default, Haskell evaluates something only when it is needed.
|
||||
In consequence, it provides a very elegant way to manipulate infinite
|
||||
In consequence, it provides an elegant way to manipulate infinite
|
||||
structures, for example.
|
||||
|
||||
A last warning about how you should read Haskell code.
|
||||
For me, it is like reading scientific papers.
|
||||
Some parts are very clear, but when you see a formula, just focus and read
|
||||
Some parts are clear, but when you see a formula, just focus and read
|
||||
slower.
|
||||
Also, while learning Haskell, it /really/ doesn't matter much if you don't
|
||||
understand syntax details.
|
||||
|
|
|
@ -7,22 +7,104 @@
|
|||
#+OPTIONS: auto-id:t toc:t
|
||||
#+STARTUP: overview
|
||||
|
||||
[[https://ethanschoonover.com/solarized/][Solarized]] is a well known and quite common colorscheme.
|
||||
I used it for many years.
|
||||
At first, you need to try it for some time.
|
||||
But after a few weeks it is very hard to change.
|
||||
The colorscheme of my website is the colorscheme I use for my terminal and
|
||||
most of my environment.
|
||||
|
||||
It is very nice to use on a day to day in a terminal.
|
||||
It has a low contrast which is quite valuable to prevent migraine.
|
||||
This is inspired by both [[https://ethanschoonover.com/solarized/][Solarized]] and [[https://nordtheme.com][Nord]].
|
||||
|
||||
Ethan Shoovnover its creator give plenty of information about how he
|
||||
created it.
|
||||
So I used [[https://ethanschoonover.com/solarized/][Solarized]] for many years.
|
||||
And it was really difficult finding a new one that suits my taste.
|
||||
|
||||
I wanted a "grayer" or more yellow colorscheme.
|
||||
So I kept the main principle and opened a few parameters.
|
||||
Stil I disliked the blue-green dark background.
|
||||
I wanted to change that background color.
|
||||
Or having a grayer background.
|
||||
|
||||
Ethan Shoovnover the creator of Solarized gave plenty of information about
|
||||
how he created it.
|
||||
|
||||
Also I stumbled upon the [[https://nordtheme.com][Nord]] theme.
|
||||
And I really liked it.
|
||||
But while the colors are great, it is not as easy to switch from light to
|
||||
dark theme than with solarized because Solarized has a lot of nice
|
||||
properties.
|
||||
|
||||
So I kept the main principle used to create Solarized but freed a few parameters.
|
||||
The tint of the dark and light colors for the background and the text, as
|
||||
well as the contrast of the colors.
|
||||
|
||||
And I created this minimal application in Purescript:
|
||||
|
||||
https://solaryzed.esy.fun
|
||||
|
||||
It is still not perfect, because the real theme I use for my website as a
|
||||
slightly bigger contrast for text.
|
||||
|
||||
Here is the CSS you could use:
|
||||
|
||||
#+begin_export html
|
||||
<style>#colors div { display: inline-block; }</style>
|
||||
<div id="colors">
|
||||
<div style="background: hsl(218.82, 20.99%, 15.88%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b03">b03</div>
|
||||
<div style="background: hsl(222.35, 16.5%, 20.2%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b02">b02</div>
|
||||
<div style="background: hsl(222.35, 8.72%, 38.24%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b01">b01</div>
|
||||
<div style="background: hsl(221.25, 6.56%, 47.84%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b00">b00</div>
|
||||
<div style="background: hsl(220.0, 6.98%, 57.84%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b0">b0</div>u
|
||||
<div style="background: hsl(222.86, 8.64%, 68.24%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b1">b1</div>
|
||||
<div style="background: hsl(223.64, 26.83%, 91.96%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b2">b2</div>
|
||||
<div style="background: hsl(223.64, 84.62%, 97.45%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b3">b3</div>
|
||||
<div style="background: hsl(38.48, 36.22%, 49.8%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="y">y</div>
|
||||
<div style="background: hsl(17.23, 38.52%, 47.84%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="o">o</div>
|
||||
<div style="background: hsl(8.09, 35.74%, 51.18%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="r">r</div>
|
||||
<div style="background: hsl(336.75, 33.06%, 52.55%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="m">m</div>
|
||||
<div style="background: hsl(229.6, 32.75%, 55.1%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="v">v</div>
|
||||
<div style="background: hsl(205.19, 52.19%, 50.78%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="b">b</div>
|
||||
<div style="background: hsl(176.09, 75.0%, 36.08%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="c">c</div>
|
||||
<div style="background: hsl(60.91, 28.7%, 45.1%); height: 60.0px; width: 60.0px; line-height: 60.0px; text-align: center" id="g">g</div>
|
||||
</div>
|
||||
#+end_export
|
||||
|
||||
#+begin_src css :tangle solaryzed.css
|
||||
:root {
|
||||
color-scheme: light dark; /* support color scheme */
|
||||
--b03: #202631;
|
||||
--b02: #2b313c;
|
||||
--b01: #656b74;
|
||||
--b00: #727781;
|
||||
--b0: #989ea8;
|
||||
--b1: #b0bac7;
|
||||
--b2: #e5e8ed;
|
||||
--b3: #f4f7ff;
|
||||
--y: #a98d50;
|
||||
--o: #aa6550;
|
||||
--r: #b85a64;
|
||||
--m: #af53b0;
|
||||
--v: #846f93;
|
||||
--b: #5679a4;
|
||||
--c: #4c8493;
|
||||
--g: #728b5c;
|
||||
|
||||
--bg: var(--b3);
|
||||
--fg: var(--b02);
|
||||
--fg0: var(--b0); /* lower contrast */
|
||||
--bg2: var(--b2); /* second color block background */
|
||||
--fg2: var(--b01); /* second color block foreground */
|
||||
--acc: var(--o); /* accent color */
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
/* Dark */
|
||||
--bg: var(--b03);
|
||||
--fg: var(--b0);
|
||||
--fg0: var(--b00); /* lower contrast */
|
||||
--bg2: var(--b02); /* second color block background */
|
||||
--fg2: var(--b1); /* second color block foreground */
|
||||
--acc: var(--g); /* accent color */
|
||||
}
|
||||
}
|
||||
|
||||
body,.main {
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
}
|
||||
#+end_src
|
||||
|
|
18
src/posts/0012-solaryzed-theme/solaryzed.css
Normal file
18
src/posts/0012-solaryzed-theme/solaryzed.css
Normal file
|
@ -0,0 +1,18 @@
|
|||
:root {
|
||||
--b03: #202631;
|
||||
--b02: #2b303c;
|
||||
--b01: #595e6a;
|
||||
--b00: #727782;
|
||||
--b0: #8c919b;
|
||||
--b1: #a7abb5;
|
||||
--b2: #e5e8f0;
|
||||
--b3: #f3f6fe;
|
||||
--y: #ad8c51;
|
||||
--o: #a9664b;
|
||||
--r: #af6256;
|
||||
--m: #ae5e7d;
|
||||
--v: #6774b2;
|
||||
--b: #408cc3;
|
||||
--c: #17a198;
|
||||
--g: #939452;
|
||||
}
|
Loading…
Reference in a new issue