Haskellに入門する
作った(ている)もの
https://github.com/ddddddO/fakelly
https://github.com/ddddddO/fizzbuzz-haskell
読みもの
Learn You a Haskell for Great Good!
とても良いそう
このサイトの邦訳「すごいHaskell たのしく学ぼう!」を読んだ。Functor辺りからもう一度読む
https://www.iijlab.net/members/yuji-yamamoto.html
ArticlesにあるHaskellの記事の以下読んだ、良かった
https://employment.en-japan.com/engineerhub/entry/2017/08/25/110000
https://employment.en-japan.com/engineerhub/entry/2017/09/11/110000
https://employment.en-japan.com/engineerhub/entry/2017/10/03/110000
「Haskell入門 関数型プログラミング言語の基礎と実践」
「せつラボ ~圏論の基本~」
「矢澤にこ先輩といっしょに代数!」
Semigroupとは? Monoid? 環?
登壇されていたそう。半群の手前のマグマという代数についてもある
https://ja.m.wikibooks.org/wiki/Haskell/圏論
圏論的な〈ものの見方・考え方〉入門
面白かった。現実世界の具体的な話で圏を説明されてる
ログ
作業ログ
Haskellの環境構築2023
How to install をやった(WSL2)
code:sh
~/github.com/ddddddO/work
22:12:43 > curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
Welcome to Haskell!
This script can download and install the following binaries:
* ghcup - The Haskell toolchain installer
* ghc - The Glasgow Haskell Compiler
* cabal - The Cabal build tool for managing Haskell software
* stack - A cross-platform program for developing Haskell projects (similar to cabal)
* hls - (optional) A language server for developers to integrate with their editor/IDE
ghcup installs only into the following directory,
which can be removed anytime:
/home/ochi/.ghcup
Press ENTER to proceed or ctrl-c to abort.
Note that this script can be re-run at any given time.
-------------------------------------------------------------------------------
Detected bash shell on your system...
Do you want ghcup to automatically add the required PATH variable to "/home/ochi/.bashrc"?
P Yes, prepend A Yes, append N No ? Help (default is "P").
P
-------------------------------------------------------------------------------
Do you want to install haskell-language-server (HLS)?
HLS is a language-server that provides IDE-like functionality
and can integrate with different editors, such as Vim, Emacs, VS Code, Atom, ...
Also see https://haskell-language-server.readthedocs.io/en/stable/
Y Yes N No ? Help (default is "N").
Y
-------------------------------------------------------------------------------
Do you want to enable better integration of stack with GHCup?
This means that stack won't install its own GHC versions, but uses GHCup's.
For more information see:
https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-installation-customisation-experimental
If you want to keep stacks vanilla behavior, answer 'No'.
Y Yes N No ? Help (default is "Y").
Y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15.2M 100 15.2M 0 0 7567k 0 0:00:02 0:00:02 --:--:-- 7567k
Info downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/ochi/.ghcup/cache/ghcup-0.0.7.yaml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 243k 100 243k 0 0 1150k 0 --:--:-- --:--:-- --:--:-- 1144k
Info Upgrading GHCup...
Warn No GHCup update available
System requirements
Please ensure the following distro packages are installed before continuing (you can exit ghcup and return at any time): build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
Press ENTER to proceed or ctrl-c to abort.
Installation may take a while.
Info downloading: https://downloads.haskell.org/~ghc/9.2.7/ghc-9.2.7-x86_64-deb10-linux.tar.xz as file /home/ochi/.ghcup/cache/ghc-9.2.7-x86_64-deb10-linux.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 232M 100 232M 0 0 24.5M 0 0:00:09 0:00:09 --:--:-- 23.7M
Info verifying digest of: ghc-9.2.7-x86_64-deb10-linux.tar.xz
Info Unpacking: ghc-9.2.7-x86_64-deb10-linux.tar.xz to /home/ochi/.ghcup/tmp/ghcup-76338424cb07b0b8
Info Installing GHC (this may take a while)
Info Merging file tree from "/home/ochi/.ghcup/tmp/ghcup-b491a4133923fa7a/home/ochi/.ghcup/ghc/9.2.7" to "/home/ochi/.ghcup/ghc/9.2.7"
Info GHC installation successful
Info downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/ochi/.ghcup/cache/ghcup-0.0.7.yaml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
Info GHC 9.2.7 successfully set as default version
Info downloading: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz as file /home/ochi/.ghcup/cache/cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4523k 100 4523k 0 0 2041k 0 0:00:02 0:00:02 --:--:-- 2042k
Info verifying digest of: cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz
Info Unpacking: cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz to /home/ochi/.ghcup/tmp/ghcup-a762a9697ed25331
Info Installing cabal
Info Cabal installation successful
Config file path source is default config file.
Config file /home/ochi/.cabal/config not found.
Writing default configuration to /home/ochi/.cabal/config
Downloading the latest package list from hackage.haskell.org
Updated package list of hackage.haskell.org to the index-state 2023-04-20T12:43:21Z
Info downloading: https://downloads.haskell.org/~hls/haskell-language-server-1.10.0.0/haskell-language-server-1.10.0.0-x86_64-linux-deb11.tar.xz as file /home/ochi/.ghcup/cache/haskell-language-server-1.10.0.0-x86_64-linux-deb11.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 167M 100 167M 0 0 23.3M 0 0:00:07 0:00:07 --:--:-- 27.5M
Info verifying digest of: haskell-language-server-1.10.0.0-x86_64-linux-deb11.tar.xz
Info Unpacking: haskell-language-server-1.10.0.0-x86_64-linux-deb11.tar.xz to /home/ochi/.ghcup/tmp/ghcup-5b3d3ef73663e95a
Info Installing HLS
Info Merging file tree from "/home/ochi/.ghcup/tmp/ghcup-076688fe7f56b10a/home/ochi/.ghcup/hls/1.10.0.0" to "/home/ochi/.ghcup/hls/1.10.0.0"
Info HLS installation successful
Info This is just the server part of your LSP configuration. Consult the README on how to
... configure HLS, your project and your LSP client in your editor:
... https://haskell-language-server.readthedocs.io/en/stable/
...
Info downloading: https://github.com/commercialhaskell/stack/releases/download/v2.9.3/stack-2.9.3-linux-x86_64-static.tar.gz as file /home/ochi/.ghcup/cache/stack-2.9.3-linux-x86_64-static.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 13.2M 100 13.2M 0 0 2244k 0 0:00:06 0:00:06 --:--:-- 3697k
Info verifying digest of: stack-2.9.3-linux-x86_64-static.tar.gz
Info Unpacking: stack-2.9.3-linux-x86_64-static.tar.gz to /home/ochi/.ghcup/tmp/ghcup-2c9fc72c7b3c58d2
Info Installing stack
Info Stack installation successful
Info Stack manages GHC versions internally by default. To improve integration, please visit:
... https://www.haskell.org/ghcup/guide/#stack-integration
...
... Also check out:
... https://docs.haskellstack.org/en/stable/yaml_configuration
...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 707 0 --:--:-- --:--:-- --:--:-- 710
===============================================================================
OK! /home/ochi/.bashrc has been modified. Restart your terminal for the changes to take effect,
or type "source /home/ochi/.ghcup/env" to apply them in your current terminal session.
===============================================================================
All done!
To start a simple repl, run:
ghci
To start a new haskell project in the current directory, run:
cabal init --interactive
To install other GHC versions and tools, run:
ghcup tui
If you are new to Haskell, check out https://www.haskell.org/ghcup/steps/
~/github.com/ddddddO/work
22:31:23 >
Haskellは、型システムの学習にも良いそう
ghc Hoge.hs 実行でエラー出ても、以下で解決
https://stackoverflow.com/questions/71681370/linking-error-when-trying-to-compile-haskell-code