- Get Haskell Stack
- And [Haskell VS Code Extension)(https://marketplace.visualstudio.com/items?itemName=haskell.haskell)
curl -sSL https://get.haskellstack.org/ | sh
First, setup your ~/.stack/config.yaml
with your basic info to be used for all new projects, e.g.:
templates:
params:
author-name: Donald Thompson
author-email: donald@witt3rd.com
copyright: Copyright (c) 2020
github-username: witt3rd
category: Experimental
(see Categories)
stack new my-project [some-template]
stack install pretty-simple
-- Pretty-printing
:set -package-id pretty-simple
:set -interactive-print Text.Pretty.Simple.pPrint
-- Turn on some language extensions you use a lot
:seti -XFlexibleContexts -XOverloadedStrings -XTypeApplications
-- Break on errors
:seti -fbreak-on-error
-- Automatically show the code around breakpoints
:set stop :list
-- Use a cyan lambda as the prompt
:set prompt "\ESC[1;36m\STXλ \ESC[m\STX"
-- Better errors
:set -ferror-spans -freverse-errors -fprint-expanded-synonyms
-- Path-local ghci history
:set -flocal-ghci-history
-- Better typed holes
:set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2
:m Data.Array
ax = array (0,3) [(0,'a'),(1,'b'),(2,'c'),(3,'d')]
assocs ax
-- [(0,'a'),(1,'b'),(2,'c'),(3,'d')]
bounds ax
-- (0,3)
fmap (\x->x+1) (Just 5)
-- 6
(\x->x+1) <$> (Just 5)
-- 6
(+1) <$> (Just 5)
-- 6
(+1) <$> [1..5]
-- [2,3,4,5,6]
((+1) <$>) <$> Just [1..5]
-- Just [2,3,4,5,6]
-- :m Data.Functor.Compose
(+1) <$> Compose (Just [1..5])
-- Compose(Just [2,3,4,5,6])
getCompose ((+1) <$> Compose (Just [1..5]))
-- Just [2,3,4,5,6]
getCompose ((*2) . (+1) <$> Compose (Just [1..5]))
-- Just [4,6,8,10,12]