Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on Haskell.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/haskell.e>
#           or at <http://angg.twu.net/e/haskell.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.Prelude»			(to "Prelude")
# «.haskell-docs»		(to "haskell-docs")
# «.comprehension»		(to "comprehension")
# «.list-comprehensions»	(to "list-comprehensions")
# «.let-and-where»		(to "let-and-where")
# «.newtype»			(to "newtype")
# «.class-and-instance»		(to "class-and-instance")
# «.record-syntax»		(to "record-syntax")
# «.pipeThrough»		(to "pipeThrough")
# «.System.Process»		(to "System.Process")
# «.applicative»		(to "applicative")
# «.liftM2»			(to "liftM2")
# «.import»			(to "import")
# «.tutorials»			(to "tutorials")
# «.hudak»			(to "hudak")
# «.bind»			(to "bind")
# «.return-and-bind»		(to "return-and-bind")
# «.type-inference-heuristically»	(to "type-inference-heuristically")
# «.hugs»			(to "hugs")
# «.entre»			(to "entre")
# «.haskore»			(to "haskore")
# «.sum_chars»			(to "sum_chars")
# «.runhugs»			(to "runhugs")
# «.thih»			(to "thih")
# «.parsec»			(to "parsec")
# «.yarrow»			(to "yarrow")
# «.ghc»			(to "ghc")
# «.ghc-deb»			(to "ghc-deb")
# «.gh»				(to "gh")
# «.epigram»			(to "epigram")
# «.multi-line»			(to "multi-line")
# «.runhaskell»			(to "runhaskell")
# «.:info»			(to ":info")
# «.:set+t»			(to ":set+t")
# «.main»			(to "main")
# «.:main»			(to ":main")
# «.getArgs»			(to "getArgs")
# «.:def»			(to ":def")
# «.type-signature»		(to "type-signature")
# «.eepitch-hugs»		(to "eepitch-hugs")
# «.haskell-mode»		(to "haskell-mode")
# «.haskell-mode-M-e»		(to "haskell-mode-M-e")
# «.daume-yaht»			(to "daume-yaht")
# «.xmonad»			(to "xmonad")
# «.xmonad-rcfile»		(to "xmonad-rcfile")
# «.escape-from-zurg»		(to "escape-from-zurg")
# «.luautils»			(to "luautils")
# «.distributivity»		(to "distributivity")
# «.cabal»			(to "cabal")
# «.cabal-PATH»			(to "cabal-PATH")
# «.hackage»			(to "hackage")
# «.lhs2tex»			(to "lhs2tex")
# «.haskell-platform»		(to "haskell-platform")
# «.programming-cats»		(to "programming-cats")
# «.Hask»			(to "Hask")
# «.books-about-haskell»	(to "books-about-haskell")
# «.learn-hfm»			(to "learn-hfm")
# «.haskell-stack»		(to "haskell-stack")
# «.stridi»			(to "stridi")
# «.diagrams»			(to "diagrams")
# «.hutton-book»		(to "hutton-book")
# «.typing-the-composition»	(to "typing-the-composition")
# «.typing-do-notation»		(to "typing-do-notation")
# «.haskell-to-core»		(to "haskell-to-core")
# «.haskell-report»		(to "haskell-report")
# «.where»			(to "where")
# «.foldr»			(to "foldr")
# «.tuples»			(to "tuples")
# «.monomorphism-restriction»	(to "monomorphism-restriction")
# «.translating-Ax»		(to "translating-Ax")
# «.lawvere»			(to "lawvere")
# «.hoodle»			(to "hoodle")
# «.libtinfo-missing»		(to "libtinfo-missing")
# «.music»			(to "music")
# «.calling-lua»		(to "calling-lua")
# «.System.IO»			(to "System.IO")
# «.pipes»			(to "pipes")
# «.kan-extensions»		(to "kan-extensions")
# «.dist-install»		(to "dist-install")
# «.hsc2hs»			(to "hsc2hs")
# «.tagless»			(to "tagless")
# «.AD.hs»			(to "AD.hs")
# «.etags»			(to "etags")
# «.hasktags»			(to "hasktags")
# «.hs-tags»			(to "hs-tags")
# «.hoogle»			(to "hoogle")
# «.:def-hoogle»		(to ":def-hoogle")
# «.hayoo»			(to "hayoo")
# «.InstanceSigns»		(to "InstanceSigns")
# «.template-haskell»		(to "template-haskell")
# «.no-instance-for»		(to "no-instance-for")
$ «.stg»			(to "stg")
# «.graph-reduction»		(to "graph-reduction")
# «.rewrite-rules»		(to "rewrite-rules")
# «.ReadS»			(to "ReadS")




#####
#
# The Haskell Prelude (in GHC)
# 2022sep22
#
#####

# «Prelude»  (to ".Prelude")
# (find-sh "locate -i ghc | grep -i prelude")
# (find-ghcsh "find * | sort")
# (find-ghcsh "find * | sort | grep Prelude")
# (find-ghcsh "find * | sort | grep Show")
# (find-ghcsh "find * | sort | grep Data.Maybe")
# (find-ghcsh "find * | sort | grep Applicative")
# (find-ghcbasesh "find * | sort")
# (find-ghcbasesh "find * | sort | grep 'hs$'")
# (find-ghcbasefile "")
# (find-ghcbasegrep "grep --color=auto -nRH --null -e Kleisli *")
# (find-ghcbasegrep "grep --color=auto -niRH --null -e laws *")
# (find-ghcbasegrep "grep --color=auto -nRH --null -e RULES *")
# (find-ghcfile "libraries/base/")
# (find-ghcfile "libraries/base/Prelude.hs")
# (find-ghcfile "libraries/base/Control/")
# (find-ghcfile "libraries/base/Control/Applicative.hs")
# (find-ghcfile "libraries/base/Control/Monad.hs")
# (find-ghcfile "libraries/base/Control/Monad.hs" "{- $naming")
# (find-ghcfile "libraries/base/Data/")
# (find-ghcfile "libraries/base/Data/Either.hs")
# (find-ghcfile "libraries/base/Data/Foldable.hs")
# (find-ghcfile "libraries/base/Data/Functor.hs")
# (find-ghcfile "libraries/base/Data/List.hs")
# (find-ghcfile "libraries/base/Data/Maybe.hs")
# (find-ghcfile "libraries/base/Data/Traversable.hs")
# (find-ghcfile "libraries/base/Data/Tuple.hs")
# (find-ghcfile "libraries/base/GHC/")
# (find-ghcfile "libraries/base/GHC/Base.hs")
# (find-ghcfile "libraries/base/GHC/Enum.hs")
# (find-ghcfile "libraries/base/GHC/Float.hs")
# (find-ghcfile "libraries/base/GHC/Num.hs")
# (find-ghcfile "libraries/base/GHC/Real.hs")
# (find-ghcfile "libraries/base/GHC/Show.hs")
# (find-ghcfile "libraries/base/System/")
# (find-ghcfile "libraries/base/System/IO.hs")
# (find-ghcfile "libraries/base/System/IO/Error.hs")
# (find-ghcfile "libraries/base/Text/")
# (find-ghcfile "libraries/base/Text/Read.hs")





#####
#
# Haskell docs in Debian: the Haskell98 report & tutorial
# 2011nov17 / 2022oct03
#
#####

# «haskell-docs»  (to ".haskell-docs")
# (find-angg ".emacs" "haskell")
# (find-angg ".emacs" "haskell-docs")
# (find-angg ".emacs" "ee-rstdoc-:h98")
# (find-zsh "installeddebs | sort | grep haskell")
# (find-zsh "availabledebs | sort | grep haskell")

# (find-status   "haskell98-report")
# (find-vldifile "haskell98-report.list")
# (find-udfile   "haskell98-report/")
# (find-status   "haskell98-tutorial")
# (find-vldifile "haskell98-tutorial.list")
# (find-udfile   "haskell98-tutorial/")
# (find-sh0 "zcat /usr/share/doc/haskell98-report/haskell98-report.pdf.gz > ~/tmp/haskell98-report.pdf")
# (code-pdf-page "h98" "/usr/share/doc/haskell98-report/haskell98-report.pdf.gz")
# (code-pdf-text "h98" "/usr/share/doc/haskell98-report/haskell98-report.pdf.gz")



https://www.haskell.org/tutorial/haskell-98-tutorial.pdf

# file:///usr/share/doc/haskell98-report/html/index.html
# file:///usr/share/doc/haskell98-report/html/haskell98-report-html/index.html
# file:///usr/share/doc/haskell98-tutorial/html/index.html
# file:///usr/share/doc/haskell98-tutorial/html/indextutorial.html

# (find-h98doc "index")
# (find-h98doc "index98")
# (find-h98doc "basic#monad-class")
# (find-h98doc "io-13#io")





# (find-hask98reportfile "")
# (find-hask98reportsw3m "index.html")
# (find-hask98reportsw3m "index98.html")
# (find-hask98tutfile "")
# (find-hask98reportw3m "index.html")

# (code-c-d "h98reph" "/usr/share/doc/haskell98-report/html/haskell98-report-html/")
# (code-c-d "h98tuth" "/usr/share/doc/haskell98-tutorial/html/")
# (find-h98rephfile "")
# (find-h98tuthfile "")
# (find-h98rephw3m "index.html")
# (find-h98rephw3m "monad.html")
# (find-h98tuthw3m "index.html")
# (find-h98tuthw3m "indextutorial.html")





#####
#
# Comprehension
# 2012mar30
#
#####

# «comprehension»  (to ".comprehension")
(find-angg "HASKELL/Comprehensions1.hs")
# (find-dn5 "gabriela-app.lua" "comprehension")
# (find-hask98tutw3m "goodies.html#tut-list-comps")
# http://www.haskell.org/haskellwiki/List_comprehension
# (find-hask98reportw3m "exps.html#list-comprehensions")
# http://en.wikipedia.org/wiki/List_comprehension




#####
#
# list-comprehensions
# 2021jan10
#
#####

# «list-comprehensions»  (to ".list-comprehensions")
# (find-huttonbookpage  67 "5" "List comprehensions")
# (find-huttonbooktext  67 "5" "List comprehensions")
# (find-rwhaskellpage (+ 40 10) "ghci> [1..10]")
# (find-rwhaskelltext (+ 40 10) "ghci> [1..10]")
# (find-anggfile "HASKELL/Comprehensions1.hs")
# (find-fline "~/LOGS/2021jan10.haskell")
# (find-ghcfile "libraries/base/Control/Monad.hs" "guard True")
# file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/Control-Monad.html#g:6
# (find-h98tdoc "stdclasses")
# (find-h98tdoc "stdclasses#tut-enum-classes")
# (find-h98doc  "exps#arithmetic-sequences")

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
[(a,b) | a <- [0,1], b <- [a+1,a+2]]
[(a,b) | a <- [0,1], b <- [a+1,a+2], a+b < 4]
[(x,y) | y <- [3,2..0], x <- [0..y]]
[(x,y) | y <- [3,2..0], x <- [0..y], x+y <= 4]

:?
:module +Control.Monad
:t guard
[(a,b) | a <- [0,1], b <- [a+1,a+2],             a+b < 4 ]
[(a,b) | a <- [0,1], b <- [a+1,a+2], _ <- guard (a+b < 4)]

do a <- [0,1]; b <- [a+1,a+2]; return (a,b)
do a <- [0,1]; b <- [a+1,a+2];      guard (a+b < 4); return (a,b)
do a <- [0,1]; b <- [a+1,a+2]; _ <- guard (a+b < 4); return (a,b)



#####
#
# let and where
# 2022sep24
#
#####

# «let-and-where»  (to ".let-and-where")
# (find-books "__comp/__comp.el" "haskell-hutton")
# (find-books "__comp/__comp.el" "haskell-hutton" "The layout rule" "where")
# (find-books "__comp/__comp.el" "haskell-hutton" "The let mechanism")



#####
#
# newtype
# 2022sep18
#
#####

# «newtype»  (to ".newtype")
# (find-angggrep "grep --color=auto -niH --null -e newtype HASKELL/*.hs")
# (find-books "__comp/__comp.el" "haskell-hutton")
# (find-books "__comp/__comp.el" "haskell-hutton" "Newtype declarations")




#####
#
# class-and-instance
# 2022sep18
#
#####

# «class-and-instance»  (to ".class-and-instance")
# (find-h98doc "decls#sect4.1")
# (find-h98tdoc "classes")
# (find-books "__comp/__comp.el" "haskell-hutton")
# (find-books "__comp/__comp.el" "haskell-hutton" "Class and instance declarations")
# (find-angggrep "grep --color=auto -nH --null -e hutton HASKELL/*.hs")
# (find-anggfile "HASKELL/inttree.hs")
# (find-anggfile "HASKELL/Classes1.hs")
# (find-ghcugdoc "ghci#ghci-cmd-instances")
# https://fare.livejournal.com/155094.html John Peterson, Mark Jones: "Implementing Type Classes" (1993)
# https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.3952




#####
#
# record-syntax
# 2022sep24
#
#####

# «record-syntax»  (to ".record-syntax")
# (find-h98doc "exps#sect3.15")
# (find-h98doc "exps#record-update")
# (find-h98doc "exps#record-construction")
# (find-books "__comp/__comp.el" "haskell-rw")
# (find-books "__comp/__comp.el" "haskell-rw" "Record Syntax")
# (find-books "__comp/__comp.el" "haskell-2010")
# (find-books "__comp/__comp.el" "haskell-2010" "record")
# (find-angg "HASKELL/Process1.hs")
# (find-fline "~/LOGS/2022oct01.haskell" "data Driver m = Driver {")
# (find-rwhaskellpage (+ 40 55) "Record Syntax")
# (find-rwhaskelltext (+ 40 55) "Record Syntax")

<EvanR> data Employee = Employee { name :: String, salary :: Int }
<edrx> yep
<EvanR> data Driver m = Driver { putChar :: Char -> m (), getChar
        :: m Char }



#####
#
# pipeThrough
# 2022oct09
#
#####

# «pipeThrough»  (to ".pipeThrough")
# (find-es "haskell" "System.Process")


#####
#
# System.Process
# 2022oct09
#
#####

# «System.Process»  (to ".System.Process")
# (find-angg "HASKELL/Tac1.hs")
# (find-sh "locate System.Process")
# (find-sh "locate System/Process")
# (find-ghcfile "libraries/process/")
# (find-ghcfile "libraries/process/System/Process.hs" "-- createProcess")
# (find-ghcfile "libraries/process/System/Process.hs" "-- > withCreateProcess")
# (find-hoogle "createProcess")
# https://lotz84.github.io/haskellbyexample/ex/spawning-processes ***
# https://stackoverflow.com/questions/21034040/haskell-createprocess-and-read-from-handle
# https://www.reddit.com/r/haskell/comments/evegox/running_external_programs_with_haskell/ *
# https://www.reddit.com/r/haskell/comments/1nkw1c/usage_of_package_systemprocess/

Prelude System.Process System.IO> import System.Process
Prelude System.Process System.IO> import System.IO
Prelude System.Process System.IO> :{
Prelude System.Process System.IO| withCreateProcess (proc "ghc" ["--help"]){ std_out = CreatePipe } (\_ (Just outputH) _ procH -> do
Prelude System.Process System.IO|     outputText <-hGetContents outputH
Prelude System.Process System.IO|     print $ take 70 outputText
Prelude System.Process System.IO|   )
Prelude System.Process System.IO| :}
"Usage:\n\n    ghc [command-line-options-and-input-files]\n\nTo compile and"
*** Exception: terminateProcess: permission denied (Permission denied)




#####
#
# applicative
# 2022sep30
#
#####

# «applicative»  (to ".applicative")
# (find-anggfile "HASKELL/Applicative1.hs")

# (find-books "__comp/__comp.el" "haskell-hutton" "Applicatives")
# (find-ghcfile "libraries/base/Control/Applicative.hs")
# http://www.soi.city.ac.uk/~ross/papers/Applicative.html
# https://www.staff.city.ac.uk/~ross/papers/Applicative.pdf
# (find-angg "HASKELL/State1.hs")




#####
#
# liftM2
# 2022sep30
#
#####

# «liftM2»  (to ".liftM2")
# (find-fline "~/LOGS/2022sep30.haskell")
# (find-fline "~/LOGS/2022sep30.haskell2")
# (find-ghcbasegrep "grep --color=auto -nRH --null -e liftM2 *")
# (find-ghcbasefile "GHC/Base.hs" "liftM2 f m1 m2          =")

liftM2  :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2    f       m1   m2    = do { x1 <-  m1 ; x2 <-  m2 ; return (f x1 x2) }
       ========= ==== ====          ==    ====  ==    ====            == ==
       a1->a2->r m a1 m a2          a1    m a1  a2    m a2            a1 a2
==========================                                          =======
             m r                                                       r
                                                            ================
                                                                     m r

liftM2    f       m1   m2    =  m1  >>= \x1 ->  m2  >>= \x2 -> f x1 x2
       ========= ==== ====     ====      ==    ====      ==      == ==
       a1->a2->r m a1 m a2     m a1      a1    m a2      a2      a1 a2
================                                               =======
 m a1->m a2->m r                                                 m r
=====================                                   ==============
       m a2->m r                                             a2->m r
==========================                     =======================
             m r                                                 m r
                                        ==============================
                                                             a1->m r
                               =======================================
                                                                 m r  

             liftM2 ($)                      ($)
=====================================  ==============
         (a1->a2->r)->m a1->m a2->m r   (a->b)->a->b
=====================================  ==============
((a2->r)->a2->r)->m(a2->r)->m a2->m r  (a2->r)->a2->r
=====================================================
                  m(a2->r)->m a2->m r
=====================================================
                   m(a->b)->m a->m b

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:module +GHC.Base
:t ($)
:t liftM2
:t liftM2 ($)
:t liftM2 id
:hoogle liftM2
:hoogle $



#####
#
# import
# 2022sep25
#
#####

# «import»  (to ".import")
# (find-books "__comp/__comp.el" "haskell-rw" "module")
# (find-rwhaskellpage (+ 40 114)  "Generating a Haskell Program and Importing Modules")
# (find-rwhaskellpage (+ 40 123)  "Writing a Module Header")
# (find-ghcugdoc "index")
# (find-ghcugdoc "ghci#what-s-really-in-scope-at-the-prompt")
# (find-ghcugdoc "ghci#the-effect-of-load-on-what-is-in-scope")
# (find-ghcugdoc "ghci#controlling-what-is-in-scope-with-import")
# (find-ghcugdoc "ghci#using-do-notation-at-the-prompt")
# https://www.haskell.org/onlinereport/index.html
# https://www.haskell.org/onlinereport/modules.html
# https://www.haskell.org/onlinereport/syntax-iso.html
# https://www.haskell.org/onlinereport/lexemes.html#lexemes-layout





#####
#
# Recommended tutorials
# 2022sep24
#
#####

# «tutorials»  (to ".tutorials")
# (find-fline "~/LOGS/2022sep24.haskell")
# (find-fline "~/LOGS/2022sep24.haskell" "@where books")
# (find-fline "~/LOGS/2022sep24.haskell2")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
f () { tr ' ,<>' '\n\n\n\n' | sort | uniq | grep http; }
cat ~/LOGS/2022sep24.haskell  | f
cat ~/LOGS/2022sep24.haskell2 | f




#####
#
# A Gentle Introduction to Haskell, version 1998 - Hudak, Peterson, Fasel
# 2022sep24
#
#####

# «hudak»  (to ".hudak")
# (find-angg ".emacs" "ee-rstdoc-:h98t")
# https://www.haskell.org/tutorial/
# https://www.haskell.org/tutorial/haskell-98-tutorial.pdf
# https://www.haskell.org/tutorial/haskell-98-tutorial-html.tar.gz
# https://www.haskell.org/tutorial/haskell-98-tutorial-sources.tar.gz
# https://www.haskell.org/tutorial/code.tar.gz

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv ~/usrc/haskell-98-tutorial-sources/
tar -C ~/usrc/ -xvzf \
  $S/https/www.haskell.org/tutorial/haskell-98-tutorial-sources.tar.gz
cd     ~/usrc/haskell-98-tutorial-sources/


https://www.seas.upenn.edu/~cis1940/spring13/
https://www.seas.upenn.edu/~cis1940/spring13/lectures.html
https://www.seas.upenn.edu/~cis1940/spring13/lectures/05-type-classes.html
https://www.seas.upenn.edu/~cis1940/spring13/lectures/05-type-classes.lhs



#####
#
# bind
# 2022sep24
#
#####

# «bind»  (to ".bind")
# «return-and-bind»  (to ".return-and-bind")
# https://el-tramo.be/blog/async-monad/
# (find-ghcbasefile "Control/Monad.hs" "(>=>)  ")
# (find-ghcbasefile "Control/Monad.hs" "(<=<)  ")
# (find-ghcbasesh "find * | sort")
# (find-ghcbasegrep "grep --color=auto -nRH --null -e '>>=' *")
# (find-ghcbasegrep "grep --color=auto -nRiH --null -e monad * | grep -a -i class")

(>=>)       :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
f >=> g     = \x -> f x >>= g

     f      >=>      g       =   \  x   ->      f        x   >>=      g	    
-----------     -----------	   ----    -----------  ----     ----------- 
:: a -> m b     :: b -> m c	   :: a    :: a -> m b  :: a     :: b -> m c 
---------------------------	           -----------------		    
       :: a -> m c		                :: m b			    
				           ----------------------------------
				                       :: m c		    
				 --------------------------------------------
				               :: a -> m c                   

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:t (>>=)




#####
#
# type-inference-heuristically
# 2021jul26
#
#####

# «type-inference-heuristically»  (to ".type-inference-heuristically")
# (find-fline "~/LOGS/2021jul26.haskell" "type-inference.html")
# http://www.vex.net/~trebla/haskell/type-inference.html
# http://www.vex.net/~trebla/haskell/index.xhtml
# (excp 30 "typing")
# (exca    "typing")




#####
#
# Hugs
# 2011nov17
#
#####

# «hugs»  (to ".hugs")
# (find-angg ".emacs" "hugs")
# (find-status   "hugs")
# (find-vldifile "hugs.list")
# (find-udfile   "hugs/")
# (find-udfile   "hugs/examples/")
# (find-hugsbasefile "../")
# (find-hugsbasefile "../Paths_hugsbase.hs")
# (find-hugsbasefile "../Hugs.hs")
# (find-hugsbasefile "Prelude.hs")
# (find-hugsbasefile "Prelude.hs" "\nmap ")
# (find-hugsbasefile "Prelude.hs" "\nfoldl ")
# (find-hugsbasefile "")
# (find-hugsoldlibfile "")



#####
#
# entre ("Explicit Naive Term Rewriting Engine")
# 2001feb14
#
#####

# «entre»  (to ".entre")
# (find-shttpfile "www.cit.gu.edu.au/~arock/entre/")
# (find-shttpw3 "www.cit.gu.edu.au/~arock/entre/")
# (find-shttpw3 "www.cit.gu.edu.au/~arock/entre/entre.html")
# (find-entrefile "")
# (find-entrefile "entre.txt")
#*
rm -Rv $S/http/www.cit.gu.edu.au/~arock/entre/
psner http://www.cit.gu.edu.au/~arock/entre/
#*
cd $S/http/www.cit.gu.edu.au/~arock/entre/
tar -cvzf entre.tar.gz README Makefile *.lhs *.es *.html *.gif

#*
rm -Rv /usr/src/entre/
mkdir  /usr/src/entre/
cd     /usr/src/entre/
tar -xvzf $S/http/www.cit.gu.edu.au/~arock/entre/entre.tar.gz
lynx -dump entre.html > entre.txt
grep '^entre\?' entre.txt > o

#*
cd /usr/src/entre/
cat > $EEG <<'---'
entre
:?
3 + 4 * 5
:s 3 + 4 * 5
:w 3 + 4 * 5

a = 3 + 4 * 5
:p
2 * a
print_mode = s
print_mode = full verbosity
a := 3 + 4 * 5
2 * a
1 - -2
1--2
10 - 3 - 2
(10 - 3) - 2
10 - (3 - 2)
(\x -> x + 1) 41
square = \x -> x * x
square 3
le = \x -> \y -> x < y || x == y
le 3 6
add x y = x + y
:p
add 3 4
-- The next line gives an error. Why?
-- (find-entrefile "entre.txt" "entre? not p")
not p = if p then False else True
not True
fact n = if n <= 1 then 1 else n * fact (n - 1)
fact 3
:f fact 6
[-2..2]
[1, 3 .. 10]
head [1, 2, 3]
tail [3, 2, 1]
length xs = if xs == [] then 0 else 1 + length (tail xs)
:f length [1, 3 .. 10]
:f length [[], [1], [1,2]]
5 + 4 `div` 2
5 + 4 `div` 0
5 + 4 `div` 3
5 + 4 `div` (-3)
5 + 4 `div` -3
compose f g x = f (g x)
a x = x * x
b x = x + 2
compose a b 2
compose b a 2
:q
:q
---
eeg hugs entre.lhs

#*

# (code-c-d "entre" "/usr/src/entre/")
# (find-entrefile "")
# (find-entrefile "entre.txt")
# (find-entrefile "entre.txt" "Then launch entre, by typing:")







#####
#
# easter eggs
# 2000dec02
#
#####

# «sum_chars»  (to ".sum_chars")
#*
cd /tmp/
cat > hash.hs <<'---'
hash :: [Char] -> Int
hash = (foldl (+) 0) . (map ord)
---
cat > $EEG <<'---'
:load hash.hs
hash "MSDOS 6.000"
hash "SYSTEM 7.0"
hash "HASKELL%98"
hash "Haskell Ninety Eight !!"
hash "Turing!"
---
eeg hugs
#*




#####
#
# Hugs June98 (1.4+)
#
#####

cd /usr/src/
rm -Rv hugs*
tar -xvzf /snarf/ftp/haskell.org/pub/haskell/hugs/June98/hugs-June98-source.tgz
cd /usr/src/hugs/
mkdir tmp

cd /usr/src/hugs/src/unix
# ./configure --prefix=/usr/src/hugs/tmp	|& tee /usr/src/hugs/oc
./configure --prefix=/usr	|& tee /usr/src/hugs/oc
cd ..
make install	|& tee /usr/src/hugs/omi

#
# cgi demos:
#
rm -Rv /var/www/hugs
mkdir /var/www/hugs
cd /usr/src/hugs/demos/cgi/
cp -iv * /var/www/hugs
# (find-node "(gawk)One-liners")
# (find-node "(gawk)String Functions" "gsub")
for i in *.cgi; do
  cat $i \
  | awk 'NR == 1 { print "#! /usr/bin/runhugs +l" }
         NR > 1 { gsub(/\/homes\/systems\/hcompile\/cgi-bin\//,
		       "/var/www/hugs/");
		  print }' \
  > /var/www/hugs/$i 
done
for i in *.hs; do
  cat $i \
  | awk '{ gsub(/\/homes\/systems\/hcompile\/cgi-bin\//, "/var/www/hugs/");
           gsub(/http:\/\/www.haskell.org\/cgi-bin\/counter.cgi/,
		"counter.cgi");
	   print }' \
  > /var/www/hugs/$i 
done
chmod 755 /var/www/hugs/*.cgi
chown edrx:edrx /var/www/hugs/*.cgi



#
# etc:
#
cd /var/www/hugs/
lynx http://127.0.0.1/hugs/
edrxnetscape http://127.0.0.1/hugs/
mycat /var/www/hugs/*.cgi

# (find-hugsfile "src/unix/README")
# (find-hugsfile "src/unix/INSTALL" "Optional Features")
# (find-hugsfile "src/unix/configure.in")







# Testing ghc
#
cd ~/HUGS/
cat > hello.hs <<'EOF'
main = putStr "Hello, fpworld!\n"
EOF
ghc -v -o hello hello.hs |& tee og
./hello

# (find-node "(installing)Top")
# (find-node "(installing)installing_4.1")
# (find-node "(installing)GHC_test")
# (find-node "(installing)installing_6.3" "gmake")
# (find-node "(libs)Top")
# (find-node "(user)Top")





#####
#
# Hugs: prettyprinting
#
#####

# (find-hugslibfile "")
# (find-hugslibfile "exts/")
# (find-hugslibfile "exts/Pretty.lhs")

gv $S/http/www.cs.chalmers.se/~rjmh/Papers/pretty.ps &
#*
cat > $EEG <<'---'
t 1 <+> t 2 <+> (t 3 $$ (t 4 <+> t 5)) where t = int
:q
---
eeg hugs Pretty
# Broken...
#*

# Broken links:
# (find-hugsfile "lib/hugs/Pretty.lhs")
# (find-hugsfile "demos/Literate.lhs")
# (find-hugsfile "demos/cgi/")
# (find-hugsfile "demos/cgi/Pretty.hs")
# (find-hugsfile "demos/cgi/PrettyHTML.hs")
# (find-fline "~/HUGS/mypretty.hs")

1 2 3
    4 5
  6 7 8




#####
#
# Lixos?
#
#####

# (find-fline "/usr/src/hugs/lib/Prelude.hs" "instance Monad IO where")
lynx /usr/src/hugs/docs/report/io-13.html

#*
cat > $EEG <<'---'
:type filter isAscii "foo"
:type readFile "input-file"
:type writeFile "output-file" (filter isAscii "str")
:type readFile "a" >>= \s -> writeFile "b" s >> putStr "ok"
:q
---
eeg hugs
#*

  readFile "a" >>= \s -> writeFile "b" s >> putStr "ok"	:: IO ()
  readFile "a" >>= \s -> writeFile "b" s		:: IO ()
  readFile "a"                                          :: IO S
  readFile                                              :: S -> IO S
           "a"                                          :: S

		         ========= ===
		         ============= =
  ======== ===      =    ===============
  ============ === =====================    ====== ====
  ====================================== == ===========
  =====================================================
  readFile "a" >>= \s -> writeFile "b" s >> putStr "ok"




#####
#
# Parsers
#
#####

gv /snarf/http/www.cs.chalmers.se/~rjmh/Papers/arrows.ps &
gv /snarf/http/www.cs.chalmers.se/~rjmh/Papers/pretty.ps &

# (find-hugsfile "lib/Prelude.hs" "-- Monad classes")
# (find-fline "~/CRIM/005ideas" "MonadPlus")
# (find-hugsfile "lib/Prelude.hs" "-- Lists")
# (find-hugsfile "lib/Prelude.hs" "instance Monad [ ] where")

    (>>)   :: m a -> m b -> m b
    p >> q  = p >>= \ _ -> q

instance Monad [ ] where
    (x:xs) >>= f  =  f x ++ (xs >>= f)
    []     >>= f  =  []
    return x      =  [x]

-- [a1, a2, a3] >>= f   =   f a1 ++ f a2 ++ f a3
-- [a1, a2] >> [b1, b2, b3]   =   [b1, b2, b3, b1, b2, b3]
 



instance MonadZero [ ] where
    zero = []

instance MonadPlus [ ] where
    []     ++ ys = ys
    (x:xs) ++ ys = x : (xs ++ ys)




#####
#
# runhugs
# 2001feb14
#
#####

# «runhugs»  (to ".runhugs")
# (find-esfile "perl1.e" "lasagna")
# (find-hugsfile "demos/cgi/")
# (find-hugsfile "src/")
# (find-hugsfile "src/runhugs.c")

#*
cat > /tmp/h <<'---'
main = putStr "foo\n";
---
runhugs /tmp/h

#*
function rhugs () {
  cat > ${TMPHUGSFILE:-/tmp/h}
  runhugs ${TMPHUGSFILE:-/tmp/h}
  echo
}
rhugs <<'---'
main = putStr "foo";
---
rhugs <<'---'
main = do {
	putStr (show "foo");
	putStr (show [1, 2]);
}
---

#*
rhugs <<'%%%'
-- lmatch :: String -> String -> Bool
lmatch "" s = True
lmatch (c:cs) (c':cs') = if (c == c') then (lmatch cs cs') else False
lmatch _ _ = False
main = putStr (show (lmatch "foo" "foobar"))
%%%

rhugs <<'%%%'
a = 2 *
    3 + 4 * 5
main = putStr (show a)
%%%

#*




#####
#
# Typing Haskell in Haskell
# 1999? / 2021jan18
#
#####

# «thih»  (to ".thih")
# http://web.cecs.pdx.edu/~mpj/thih/thih.pdf
# https://web.cecs.pdx.edu/~mpj/thih/
# https://github.com/wh5a/thih

gv $S/http/www.cse.ogi.edu/~mpj/thih/thihA4.ps
#*
rm -Rv /usr/src/thih/
mkdir  /usr/src/thih/
cd     /usr/src/thih/
tar -xvzf $S/http/www.cse.ogi.edu/~mpj/thih/thih-Sep-1-1999.tar.gz
mv -v thih-Sep-1-1999/* .
rmdir thih-Sep-1-1999/

#*
# This needs a lot of memory, takes ~90s, and its output isn't
# something we can grok immediately.
# (eeman "1 hugs" ":set")
cd /usr/src/thih/
cat > $EEG <<'---'
main
---
eeg hugs -h1000000 SourcePrelude.hs

#*
# (code-c-d "thih" "/usr/src/thih/")
# (find-thihfile "")
# (find-thihfile "Readme")
# (find-thihfile "Readme" "Simple example")




#####
#
# Parsec
# 2000sep19
#
#####

# «parsec»  (to ".parsec")
#*
# Just to check that the binary files are exactly the .pdfs:
unzip -Z -l $S/http/www.cs.uu.nl/~daan/download/parsec/parsec.zip \
  | grep -v '/$' | l -S

#*
rm -Rv /usr/src/Parsec/
cd /usr/src/
unzip -a $S/http/www.cs.uu.nl/~daan/download/parsec/parsec.zip
cd /usr/src/Parsec/
# Remove the redundant docs, leaving only a .html and its equivalent .ps 
rm -v Doc/*.pdf Doc/parsec-letter.ps

#*
cat > $EEG <<'---'
:load Main
main
:q
---
cd /usr/src/Parsec/Examples/Mondrian/
mv Prelude.m prelude.m
eeg hugs -P:/usr/src/Parsec

#*

# (code-c-d "parsec" "/usr/src/Parsec/")
# (find-parsecw3 "Doc/parsec.html")
# (find-parsecfile "")
# (find-parsecfile "Examples/")
# (find-parsecfile "Examples/Mondrian/")




#####
#
# yarrow
# 2001may06
#
#####

# «yarrow»  (to ".yarrow")
#*
rm -Rv /usr/src/yarrow/
mkdir  /usr/src/yarrow/
cd     /usr/src/yarrow/
tar -xvzf $S/http/www.cs.kun.nl/~janz/yarrow/yarrow-src.tar.gz
#*
cd     /usr/src/yarrow/src/
export PATH=$EDRXPATH:/usr/lib/ghc-4.08.1/bin
./ghcYar	|& tee og

#*
# (code-c-d "yarrow" "/usr/src/yarrow/")
# (find-yarrowfile "")




#####
#
# ghc
# 2020aug29
#
#####

# «ghc»  (to ".ghc")
# (find-zsh "installeddebs | sort | grep ghc")
# (find-zsh "availabledebs | sort | grep ghc")

# (find-status   "ghc")
# (find-vldifile "ghc.list")
# (find-udfile   "ghc/")
# (find-status   "ghc-doc")
# (find-vldifile "ghc-doc.list")
# (find-udfile   "ghc-doc/")

file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/Prelude.html




#####
#
# Generic Haskell
# 2001nov02
#
#####

# «gh»  (to ".gh")
#*
rm -Rv /usr/src/gh-0.99/
cd /usr/src/
tar -xvzf $S/http/www.cs.uu.nl/research/projects/generic-haskell/compiler/amber/gh-0.99-source.tar.gz
cd /usr/src/gh-0.99/

./configure |& tee oc
# Needs ghc to compile...

#*
gv /usr/src/gh-0.99/doc/GHUsersGuide.pdf &

#*
# (code-c-d "gh" "/usr/src/gh-0.99/")
# (find-ghfile "")





#####
#
# epigram1
# 2007nov20
#
#####

# «epigram»  (to ".epigram")
# (find-es "agda")
# http://www.e-pig.org/
# http://www.e-pig.org/epigram1.html
# http://www.e-pig.org/downloads/epigram1.tar.gz
# http://www.mail-archive.com/epigram@durham.ac.uk/msg00285.html
#*
rm -Rf ~/usrc/epigram1/
tar -C ~/usrc/ -xvzf \
  $S/http/www.e-pig.org/downloads/epigram1.tar.gz
cd     ~/usrc/epigram1/

cd     ~/usrc/epigram1/src/
make |& tee om

#*
# (code-c-d "epigram" "~/usrc/epigram1/")
# (find-epigramfile "")
# (find-epigramfile "src/om")

# (code-ps "epigramnotes"  "~/usrc/epigram1/docs/epigram-notes.pdf")
# (code-ps "epigramsystem" "~/usrc/epigram1/docs/epigram-system.pdf")
# (find-epigramnotespage  1)
# (find-epigramsystempage 1)

# (find-epigramfile "src/emacs-epigram-interpreted.el")
# (find-epigramfile "src/emacs-epigram.el")
# (find-epigramfile "src/epigram.el")
# (find-epigramfile "src/")

the makefile calls this: "ghc -package lang ...",
which gives this error: "ghc-6.6: unknown package: lang".





#####
#
# multi-line commands in GHCi
# 2009jan21
#
#####

# «multi-line»  (to ".multi-line")
# http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html
# (find-ghcusrhw3m "ch03s04.html")
# Etch's GHCi doesn't have that, it seems...

To alleviate this issue, GHCi commands can be split over multiple
lines, by wrapping them in :{ and :} (each on a single line of its
own):

Prelude> :{
Prelude| let { g op n [] = n
Prelude|     ; g op n (h:t) = h `op` g op n t
Prelude|     }
Prelude| :}
Prelude> g (*) 1 [1..3]
6

Such multiline commands can be used with any GHCi command, and the
lines between :{ and :} are simply merged into a single line for
interpretation. That implies that each such group must form a single
valid command when merged, and that no layout rule is used. The main
purpose of multiline commands is not to replace module loading but to
make definitions in .ghci-files (see Section 3.9, "The .ghci file")
more readable and maintainable.

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)




#####
#
# runhaskell / runghc
# 2022sep20
#
#####

# «runhaskell»  (to ".runhaskell")
# http://learnyouahaskell.com/input-and-output
# (find-man "1 runhaskell")
# (find-man "1 runghc")



#####
#
# :info
# 2022oct08
#
#####

# «:info»  (to ".:info")
# (find-rwhaskellpage (+ 40 7) "ghci> :info (+)")
# (find-rwhaskelltext (+ 40 7) "ghci> :info (+)")
# (find-rwhaskellpage (+ 40 43) "ghci> :info BookInfo")
# (find-rwhaskelltext (+ 40 43) "ghci> :info BookInfo")

# (find-rwhaskellpage (+ 40 43) "Type Synonyms")
# (find-rwhaskelltext (+ 40 43) "Type Synonyms")




#####
#
# :set+t
# 2022oct08
#
#####

# «:set+t»  (to ".:set+t")
# (find-rwhaskellpage (+ 40 12) ":set +t")
# (find-rwhaskelltext (+ 40 12) ":set +t")
# (find-rwhaskellpage (+ 40 14) ":unset +t")
# (find-rwhaskelltext (+ 40 14) ":unset +t")



#####
#
# main and :main
# 2022oct08
#
#####

# «main»   (to ".main")
# «:main»  (to ".:main")
# (find-rwhaskellpage (+ 40 15) "main =")
# (find-rwhaskelltext (+ 40 15) "main =")
# (find-ghcugdoc "ghci#ghci-cmd-main")
# (find-ghcbasesh "find * | sort | grep 'hs$'")

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
main = System.Environment.getArgs >>= print
:main foo bar
:t print
:hoogle getArgs
:info getArgs
:info System.Environment.getArgs

["foo","bar"]

     main = interact wordCount
         where wordCount input = show (length (lines input)) ++ "\n"



#####
#
# getArgs
# 2022oct08
#
#####

# «getArgs»  (to ".getArgs")
# (find-rwhaskellpage (+ 40 71) "import System.Environment (getArgs)")
# (find-rwhaskelltext (+ 40 71) "import System.Environment (getArgs)")
# (find-ghcbasefile "System/Environment.hs")
# (find-ghcbasefile "System/Environment.hs" "-- getArgs, getProgName, getEnv")
# (find-ghcugdoc "ghci#ghci-cmd-main")
# (find-sh "hoogle getArgs")

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
main = System.Environment.getArgs >>= print
:main foo bar

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:module +System.Environment
main = getArgs >>= print
:main foo bar



#####
#
# :def
# 2022oct08
#
#####

# «:def»  (to ".:def")
# (to "hoogle-.ghci")
# (find-ghcugdoc "ghci#ghci-cmd-def")





#####
#
# type-signature
# 2022oct08
#
#####

# «type-signature»  (to ".type-signature")
# (find-rwhaskellpage (+ 40 22) "type signature")
# (find-rwhaskelltext (+ 40 22) "type signature")

# (find-rwhaskellpage (+ 40 41) "value constructor")
# (find-rwhaskelltext (+ 40 41) "value constructor")
# (find-rwhaskellpage (+ 40 66) "explicit structuring")
# (find-rwhaskelltext (+ 40 66) "explicit structuring")
# (find-rwhaskellpage (+ 40 103) "As-patterns")
# (find-rwhaskelltext (+ 40 103) "As-patterns")
# (find-rwhaskellpage (+ 40 131) "Creating a Package")
# (find-rwhaskelltext (+ 40 131) "Creating a Package")
# (find-rwhaskellpage (+ 40 152) "Living in an Open World")
# (find-rwhaskelltext (+ 40 152) "Living in an Open World")
# (find-rwhaskellpage (+ 40 170) "main = do")
# (find-rwhaskelltext (+ 40 170) "main = do")
# (find-rwhaskellpage (+ 40 180) "readFile and writeFile")
# (find-rwhaskelltext (+ 40 180) "readFile and writeFile")
# (find-rwhaskellpage (+ 40 182) "Filters with interact")
# (find-rwhaskelltext (+ 40 182) "Filters with interact")




#####
#
# eepitch-hugs
# 2008feb18
#
#####

# «eepitch-hugs»  (to ".eepitch-hugs")
# http://haskell.org/hugs/
# (find-status   "hugs")
# (find-vldifile "hugs.list")
# (find-udfile   "hugs/")
# (find-fline "/usr/lib/hugs/libraries/Hugs/")
# http://www.cs.bham.ac.uk/~mhe/papers/selection-monad.hs
# http://www.cs.bham.ac.uk/~mhe/papers/continuation-monad.hs

# (code-c-d "libhugs" "/usr/lib/hugs/")
# (code-c-d "hugsuserguide" "/usr/lib/hugs/docs/users_guide/")
# (find-libhugsfile "libraries/")
# (find-libhugsfile "libraries/Prelude.hs")
# (find-libhugsfile "libraries/Hugs/")
# (find-libhugsfile "libraries/Hugs/Prelude.hs")
# (find-libhugsfile "docs/users_guide/")
# (find-libhugsw3m  "docs/users_guide/index.html")
# (find-libhugsw3m  "docs/users_guide/using-hugs.html#BASIC-COMMANDS")
# (find-hugsuserguidew3m "using-hugs.html#BASIC-COMMANDS")
# (find-hugsuserguidew3m "options.html#OPTION-98")
# (find-libhugsfile "demos/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
hugs
foldl1 max [10, 20, 30]
foldl1 max [10]
foldl1 max []
foldl1 max ["1", "20", "3"]
:t [10, 20, 30]
:t foldl1
:t foldl1 max
:i foldl1
:?
:quit

hugs -98
:?
:quit

* (eepitch-hugs)
* (eepitch-kill)
* (eepitch-hugs)
:t snd
:t \x -> \f -> f x x
:t \p -> (snd p, fst p)
foldl1 max [10, 20, 30]
foldl1 max [10]
foldl1 max []
foldl1 max ["1", "20", "3"]
*;; foo

# (find-hask98reportw3m "syntax-iso.html#sect9.2")
# (find-hask98reportw3m "syntax-iso.html#sect9.2" "opencom")
# (find-angg "HASKELL/mergesort.hs")






#####
#
# haskell-mode
# 2020apr27 / 2008may23
#
#####

# «haskell-mode»  (to ".haskell-mode")
# (find-angg ".emacs"  "haskell-mode")
# (find-epackage-links 'haskell-mode "haskellmode" t)
# (find-epackage       'haskell-mode)
# (code-c-d "haskellmode" "~/.emacs.d/elpa/haskell-mode-20220529.1859/")
# (find-haskellmodefile "")
# (find-haskellmodenode "")

;; (find-es "haskell" "escape-from-zurg")
;; (find-fline "/tmp/zurg.hs")




#####
#
# Fixing M-e in haskell-mode
# 2022sep20
#
#####

# «haskell-mode-M-e»  (to ".haskell-mode-M-e")
# (find-efunctiondescr 'eval-last-sexp)
# (find-efunction      'eval-last-sexp)
# (find-haskellmodegrep "grep --color=auto -nH --null -e syntax *.el")
# (find-haskellmodegrep "grep --color=auto -nH --null -e forward-sexp-function *.el")
# (find-efunction 'ee-eval-last-sexp-default)
# (find-efunction 'ee-last-sexp)
# (find-efunction 'ee-backward-sexp)
# (find-efunctiondescr 'forward-sexp)
# (find-efunction      'forward-sexp)
# (find-egrep "grep --color=auto -nH --null -e forward-sexp-function *.el */*.el")
# (find-eevfile "ChangeLog" "forward-sexp-function")





#####
#
# Hal Daumé's "Yet Another Haskell Tutorial"
# 2008may23
#
#####

# «daume-yaht»  (to ".daume-yaht")
# http://www.cs.utah.edu/~hal/publications.html
# http://www.cs.utah.edu/~hal/htut/
# http://hal3.name/docs/daume02yaht.pdf
# (code-ps        "daumeyaht" "$S/http/hal3.name/docs/daume02yaht.pdf")
# (code-pdftotext "daumeyaht" "$S/http/hal3.name/docs/daume02yaht.pdf")
# (find-daumeyahtpage 1)
# (find-daumeyahttext)




#####
#
# xmonad
# 2010aug27
#
#####

# «xmonad»  (to ".xmonad")
# (find-status   "xmonad")
# (find-vldifile "xmonad.list")
# (find-udfile   "xmonad/")
# (find-man "1 xmonad")
# (find-man "1 xmonad" "~/.xmonad/xmonad.hs")
# (find-status   "dwm-tools")
# (find-vldifile "dwm-tools.list")
# (find-udfile   "dwm-tools/")
# http://xmonad.org/
# http://en.wikipedia.org/wiki/Xmonad
# http://ubuntu-snippets.blogspot.com/2008/08/xmonad-tiling-window-manager.html
# http://hackage.haskell.org/packages/archive/xmonad/0.9/xmonad-0.9.tar.gz
# http://xmonad.org/documentation.html
# http://haskell.org/haskellwiki/Xmonad/Config_archive
# http://haskell.org/haskellwiki/Xmonad/Config_archive#Minimal_xmonad_config_files
#*
rm -Rv ~/usrc/xmonad-0.9/
tar -C ~/usrc/ -xvzf \
  $S/http/hackage.haskell.org/packages/archive/xmonad/0.9/xmonad-0.9.tar.gz
cd     ~/usrc/xmonad-0.9/

#*
# (code-c-d "xmonad" "~/usrc/xmonad-0.9/")
# (find-xmonadfile "")
# (find-xmonadfile "Main.hs")
# (find-xmonadfile "XMonad.hs")
# (find-xmonadfile "XMonad/")
# (find-xmonadfile "XMonad/Config.hs")
# (find-xmonadfile "XMonad/Core.hs")
# (find-xmonadfile "XMonad/Layout.hs")
# (find-xmonadfile "XMonad/Main.hsc")
# (find-xmonadfile "XMonad/ManageHook.hs")
# (find-xmonadfile "XMonad/Operations.hs")
# (find-xmonadfile "XMonad/StackSet.hs")
# (find-xmonadfile "tests/")
# (find-xmonadfile "tests/Properties.hs")
# (find-xmonadfile "tests/loc.hs")
# (find-xmonadfile "util/")
# (find-xmonadfile "util/GenerateManpage.hs")
#
# (find-xmonadgrep "grep -nirH -e xk_n *")
# (find-xmonadgrep "grep -nirH -e mymodmask *")
# (find-xmonadgrep "grep -nirH -e modmask *")
# (find-xmonadfile "man/")
# (find-xmonadfile "man/xmonad.hs")

# «xmonad-rcfile»  (to ".xmonad-rcfile")
# (find-es "haskell" "xmonad-rcfile")
# http://haskell.org/haskellwiki/Xmonad/Config_archive
# http://haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen%27s_Configuration
# (find-xmonadfile "man/xmonad.hs" "windows key" "mod4Mask")
# (find-angg ".xmonad/xmonad.hs")
# (find-man "1 xmonad")
# (find-man "1 xmonad" "~/.xmonad/xmonad.hs")

http://xmonad.org/community.html




#####
#
# Escape from Zurg
# 2010oct15
#
#####

# «escape-from-zurg»  (to ".escape-from-zurg")
# http://www.artisancoder.com/2009/08/escape-from-zurg/
# http://web.engr.oregonstate.edu/~erwig/papers/Zurg_JFP04.pdf
(code-xpdf      "escapefromzurg" "$S/http/web.engr.oregonstate.edu/~erwig/papers/Zurg_JFP04.pdf")
(code-pdftotext "escapefromzurg" "$S/http/web.engr.oregonstate.edu/~erwig/papers/Zurg_JFP04.pdf")
# (find-escapefromzurgpage 1  "Contents")
# (find-escapefromzurgtext "")

http://homepages.inf.ed.ac.uk/wadler/topics/links.html#located-lambda
http://homepages.inf.ed.ac.uk/wadler/topics/links.html

#*
# (eev-bounded)

cat > /tmp/zurg.hs <<'%%%'
type Space m s = [([m],s)]

class SearchProblem s       m where
  trans            ::       s -> [(m,s)]
  isSolution       ::       ([m],s) -> Bool
  space, solutions ::       s -> Space m s

    space s = step ++ expand step
              where step = [ ([m],t) | (m,t) <- trans s ]
                    expand ss = [ (ms++ns,t) | (ms,s) <- ss,
                                               (ns,t) <- space s ]

    solutions = filter isSolution . space

        --  Fig. 2. The SearchProblem type class.


data   Toy = Buzz | Hamm | Rex | Woody         deriving (Eq,Ord,Show)
data   Pos = L | R                             deriving (Eq,Show)
type   Group = [Toy]
type   BridgePos = (Pos,Group)
type   Move = Either Toy Group

toys :: [Toy]
toys = [Buzz,Hamm,Rex,Woody]

time   :: Toy -> Int
time   Buzz = 5
time   Woody = 10
time   Rex   = 20
time   Hamm = 25

duration :: [Move] -> Int
duration = sum . map (either time (maximum.map time))

backw :: Group -> [(Move,BridgePos)]
backw xs = [(Left x,(L,sort (x:(toys \\ xs)))) | x <- xs]

forw :: Group -> [(Move,BridgePos)]
forw xs = [(Right [x,y],(R,delete y ys)) |
              x <- xs,let ys=delete x xs, y <- ys, x<y]

instance SearchProblem BridgePos Move where
  trans (L,l) = forw l
  trans (R,l) = backw (toys \\ l)
  isSolution (ms,s) = s == (R,[]) && duration ms <= 60

solution = solutions (L,toys)

      --  Fig. 3. Haskell solution for the Zurg riddle.
%%%

#*
(defun eepitch-hugs () (interactive) (eepitch-comint "hugs" "hugs"))
(defun eepitch-hugs98 () (interactive) (eepitch-comint "hugs" "hugs -98"))

* (eepitch-hugs)
* (eepitch-kill)
* (eepitch-hugs)
:?
:load /tmp/zurg.hs

* (eepitch-hugs98)
* (eepitch-kill)
* (eepitch-hugs98)
:?
:load /tmp/zurg.hs




#####
#
# Haskell <-> Lua
# 2011nov21
#
#####

# «luautils»  (to ".luautils")
# http://hackage.haskell.org/package/luautils-0.1
# http://hackage.haskell.org/package/hslua-0.3.4

2021oct26:
[HsLua]: https://hslua.org
[pandoc]: https://pandoc.org
[Lua filters]: https://pandoc.org/lua-filters.html




#####
#
# Proof of (Pv(Q&R))<-((PvQ)&(PvR))
# 2015jul01
#
#####

# «distributivity» (to ".distributivity")
# https://mail.google.com/mail/ca/u/0/#search/joaoraf%40gmail.com/FMfcgxmLbbKqmkBXSftpXSPJjMQtfdfn
# Thx to João Rafael Nicola

{-# LANGUAGE TypeOperators #-}

data a * b = a :* b
data a + b = InL a | InR b

proof :: (p + q) * (p + r) -> p + (q * r)
proof (pOrQ :* pOrR) = 
  case  pOrQ of 
    InL p -> InL p 
    InR q -> 
      case pOrR of 
        InL p -> InL p
    InR r -> InR (q :* r)



#####
#
# cabal
# 2019may18
#
#####

# «cabal» (to ".cabal")
# (find-es "cabal" "cabal-install-2022")
# (find-es "agda" "cabal-agda")
# https://agda.readthedocs.io/en/v2.6.0.1/getting-started/installation.html#installation-from-hackage
# https://agda.readthedocs.io/en/v2.6.0.1/getting-started/what-is-agda.html
# (find-zsh "installeddebs | sort | grep cabal")
# (find-zsh "availabledebs | sort | grep cabal")
# (find-status   "cabal-install")
# (find-vldifile "cabal-install.list")
# (find-udfile   "cabal-install/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti cabal-install

cabal install Cabal cabal-install

cabal install parsec
ghc-pkg check

cabal update
cabal install Agda
cabal install alex
cabal install happy
cabal install Agda



# (find-sh "cabal list")

# (find-fline "~/.cabal/")
# (find-fline "~/.cabal/packages/hackage.haskell.org/")
# (find-fline "~/.cabal/logs/Agda-2.6.0.1.log")
# (find-fline "~/.cabal/bin/")
# (find-fline "~/.cabal/bin/" "agda-mode")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
export PATH=$HOME/.cabal/bin;$PATH
agda-mode
agda-mode locate
agda-mode locate; echo

# agda-mode setup
# -> agda-mode: emacs: rawSystem: runInteractiveProcess: exec: does
#    not exist (No such file or directory)

# https://github.com/agda/agda/tree/master/doc/user-manual
# https://github.com/agda/agda/tree/master/doc/user-manual
# (find-git-links "https://github.com/agda/agda/tree/master/doc/user-manual" "user-manual")

# (find-sh "cabal --help")



#####
#
# Adding ~/.cabal/bin/ to the PATH (for Agda and Idris)
# 2019jun06
#
#####

# «cabal-PATH» (to ".cabal-PATH")
# (find-angg ".emacs" "cabal-path")
# (find-angg ".zshrc" "cabal")
# (find-fline "~/.cabal/bin/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
which agda
export PATH=$HOME/.cabal/bin:$PATH
which agda

echo $HOME




#####
#
# hackage
# 2019may18
#
#####

# «hackage» (to ".hackage")
# https://en.wikipedia.org/wiki/Haskell_(programming_language)
# http://hackage.haskell.org/
# https://hackage.haskell.org/package/Agda

# (find-zsh "installeddebs | sort | grep hackage")
# (find-zsh "availabledebs | sort | grep hackage")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
hackage




#####
#
# lhs2tex
# 2019oct23
#
#####

# «lhs2tex» (to ".lhs2tex")
# (find-status   "lhs2tex")
# (find-vldifile "lhs2tex.list")
# (find-udfile   "lhs2tex/")
# http://hackage.haskell.org/package/lhs2tex
# https://www.andres-loeh.de/lhs2tex/
# https://github.com/kosmikus/lhs2tex





#####
#
# haskell-platform
# 2019nov15
#
#####

# «haskell-platform» (to ".haskell-platform")
# (find-es "idris" "idris-on-debian")
# (find-status   "haskell-platform")
# (find-vldifile "haskell-platform.list")
# (find-udfile   "haskell-platform/")
# http://hackage.haskell.org/platform/





#####
#
# Fong, Milewski, Spivak: 18.S097: Programming with Categories
# 2020jan24
#
#####

# «programming-cats» (to ".programming-cats")
# http://brendanfong.com/programmingcats.html
# http://brendanfong.com/programmingcats_files/flyer.pdf
# http://brendanfong.com/programmingcats_files/cats4progs-DRAFT.pdf




#####
#
# The category Hask
# 2020mar28
#
#####

# «Hask» (to ".Hask")
# https://www.reddit.com/r/haskell/comments/4wk0gs/hask_is_not_a_category/





#####
#
# books-about-haskell
# 2020apr27
#
#####

# «books-about-haskell» (to ".books-about-haskell")
# https://bitemyapp.com/blog/functional-education/
# http://learnyouahaskell.com/
# http://learnyouahaskell.com/chapters
# http://learnyouahaskell.com/introduction#what-you-need
# https://wiki.haskell.org/Books
# https://www.manning.com/books/get-programming-with-haskell

apti haskell-platform




#####
#
# Learning Haskell - by Gabriele Keller and Manuel M T Chakravarty
# 2020aug29
#
#####

# «learn-hfm»  (to ".learn-hfm")
# http://learn.hfm.io/
# http://learn.hfm.io/fractals.html





#####
#
# haskell-stack
# 2020aug02
#
#####

# «haskell-stack»  (to ".haskell-stack")
# (find-es "stack")




#####
#
# stridi (by Guillaume Boisseau)
# 2020aug02
#
#####

# «stridi»  (to ".stridi")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# rm -Rfv ~/usrc/stridi/
cd      ~/usrc/
git clone https://github.com/Nadrieril/stridi
cd      ~/usrc/stridi/

export PAGER=cat
git branch --list -a
git for-each-ref
git log --oneline --graph --all -20

# (find-fline "~/usrc/")
# (find-fline "~/usrc/stridi/")
# (find-gitk  "~/usrc/stridi/")

# (code-c-d "stridi" "~/usrc/stridi/")
# (find-stridish "find * | sort")
# (find-stridifile "")
# (find-stridifile "test.hs")

# cd ~/usrc/stridi/
# stack build

cabal install singletons
cabal install HaTeX
cabal install extra

cd      ~/usrc/stridi/
git reset
cabal build    |& tee ocb

ghci test.hs

cabal run test.hs

cabal update
# (find-sh "cabal --help")



#####
#
# diagrams
# 2020aug02
#
#####

# «diagrams»  (to ".diagrams")
# https://hackage.haskell.org/package/diagrams
# https://archives.haskell.org/projects.haskell.org/diagrams/gallery.html
# http://ozark.hendrix.edu/~yorgey/pub/diagrams-FARM-15.pdf
# https://diagrams.github.io/gallery/HexVariation.html

cabal update && cabal install diagrams

# (find-cabal-links  "diagrams")
# (find-cabal-unpack "diagrams")
# (code-c-d "diagrams" "~/usrc/diagrams-1.4.0.1/")
# (find-diagramsfile "")

https://www.youtube.com/watch?v=ud_xnX9uixg
https://byorgey.wordpress.com/2012/08/28/creating-documents-with-embedded-diagrams/

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/HASKELL/DIAGRAMS/
cabal build
cabal exec diagrams-tutorial -- -o circle.svg -w 400

# (find-fline "~/HASKELL/DIAGRAMS/")





#####
#
# hutton-book
# 2020oct11
#
#####

# «hutton-book»  (to ".hutton-book")
# (find-books "__comp/__comp.el" "haskell-hutton")
# http://www.cs.nott.ac.uk/~pszgmh/Code.zip

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "~/usrc/hutton-book/")
rm -Rv ~/usrc/hutton-book/
mkdir  ~/usrc/hutton-book/
cd     ~/usrc/hutton-book/
unzip $S/http/www.cs.nott.ac.uk/~pszgmh/Code.zip
cd     ~/usrc/hutton-book/Code/

# (code-c-d "huttonbook" "~/usrc/hutton-book/Code/")
# (find-huttonbookfile "")
# (find-huttonbookfile "tictactoe.hs")

5: # (find-huttonbookfile "cipher.hs")
7: # (find-huttonbookfile "transmit.hs")
7: # (find-huttonbookfile "voting.hs")
8: # (find-huttonbookfile "machine.hs")
8: # (find-huttonbookfile "tautology.hs")
9: # (find-huttonbookfile "countdown.hs")
9: # (find-huttonbookfile "countdown2.hs")
10: # (find-huttonbookfile "hangman.hs")
10: # (find-huttonbookfile "life.hs")
10: # (find-huttonbookfile "nim.hs")
11: # (find-huttonbookfile "tictactoe.hs")
12: # (find-huttonbookfile "relabel.hs")
13: # (find-huttonbookfile "Parsing.hs")
13: # (find-huttonbookfile "calculator.hs")
13: # (find-huttonbookfile "expression.hs")
16: # (find-huttonbookfile "compiler.hs")
16: # (find-huttonbookfile "primes.hs")
17: # (find-huttonbookfile "compiler2.hs")

# (find-huttonbooktext   6 "Contents")





#####
#
# typing-the-composition
# 2021jan07
#
#####

# «typing-the-composition»  (to ".typing-the-composition")

<edrx> hi people, I have some background on type systems related to
       the lambda-cube and I am now trying to understand Haskell...
       what are your favorite presentations of the translation of the
       Hindley-Milner type system to systems in which the type
       variables are explicit? I think that I know how to do the
       translation "by common sense", and I have tested my ideas on a
       few definitions in the prelude... but I am not totally sure if
       it works on classes - I started to translate, or to "fully
       type", Functor and fmap explicitly, but my typing diagrams got
       quite big, and I guess that I would make better use of my time
       by reading what is the standard way to do that...

file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/Prelude.html#g:10
file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/src/GHC-Base.html#fmap
file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/src/GHC-Base.html#fmap
file:///usr/share/doc/ghc-doc/



#####
#
# typing-do-notation
# 2021jan10
#
#####

# «typing-do-notation»  (to ".typing-do-notation")
# (find-huttonbookpage 196 "m1 >>= \\x1 ->")
# (find-huttonbooktext 196 "m1 >>= \\x1 ->")
# (find-anggfile "HASKELL/DoNotation1.hs")

  do va <- tma
     vb <- tmb
     vc <- tmc
     tmd

  tma >>= \va ->
  tmb >>= \vb ->
  tmc >>= \vc ->
  tmd

  tma   >>= \va  -> tmb   >>= \vb  -> tmc   >>= \vc   -> tmd
  =====      ===    =====      ===    =====      ====    =====
  ::m a      ::a    ::m b      ::b    ::m c      :: c    ::m d
                                                ==============
                                                ::c->m d
                                      ========================
                                                         ::m d
                              ================================
                              ::b->m d
                    ==========================================
                                                         ::m d
            ==================================================
            ::a->m d
  ============================================================
                                                         ::m d


return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b


This:

  m1     >>= \ x1   -> m2     >>= \ x2   -> f                 x1   x2
  ------       ----    ------       ----    ----------------  ---- ----
  :: m a       :: a    :: m b       :: b    :: a -> b -> m c  :: a :: b
                                            ----------------------
                                            :: b -> m c
                                            ---------------------------
                                            :: m c                     
                                  -------------------------------------
                                  :: b -> m c
                       ------------------------------------------------
                       :: m c
             ---------------------------------------------------------- 
             :: a -> m c
  ---------------------------------------------------------------------
  :: m c

is the core version of this:

  do x1   <- m1    , x2   <- m2    , f                 x1   x2  
     ----    ------  ----    ------  ----------------  ---- ----
     :: a    :: m a  :: b    :: m b  :: a -> b -> m c  :: a :: b
                                     ----------------------     
                                     :: b -> m c                      
                                     ---------------------------
                                     :: m c                     
  --------------------------------------------------------------
  :: m c


if we invert the "<-"s, then the "do" above becomes this, that can be
typed easily:

 do m1     -> x1  , m2     -> x2  , f                 x1   x2  
    ------    ----  ------    ----  ----------------  ---- ----
    :: m a    :: a  :: m b    :: b  :: a -> b -> m c  :: a :: b
                                    ----------------------     
                                    :: b -> m c                
                                    ---------------------------
                                    :: m c                     
                              ---------------------------------
                              :: b -> m c
                    -------------------------------------------
                    :: m c
              -------------------------------------------------
              :: a -> m c
    -----------------------------------------------------------
    :: m c
 --------------------------------------------------------------
 :: m c





#####
#
# haskell-to-core
# 2021jan07
#
#####

# «haskell-to-core»  (to ".haskell-to-core")
# http://www.youtube.com/watch?v=fty9QL4aSRc Vladislav Zavialov - Haskell to Core: Understanding Haskell Features Through Their Desugaring
# (find-youtubedl-links "/sda5/videos/" nil "fty9QL4aSRc" nil "{stem}")
# (find-youtubedl-links "/sda5/videos/" "Vladislav_Zavialov_-_Haskell_to_Core_-_Understanding_Haskell_Features_Through_Their_Desugaring" "fty9QL4aSRc" ".mkv" "hstocore")
# (code-youtube "hstocore" "fty9QL4aSRc" "Vladislav Zavialov - Haskell to Core: Understanding Haskell Features Through Their Desugaring")
# (code-video "hstocorevideo" "/sda5/videos/Vladislav_Zavialov_-_Haskell_to_Core_-_Understanding_Haskell_Features_Through_Their_Desugaring-fty9QL4aSRc.mkv")
# (code-video "hstocorevideo" "/home/videos/Vladislav_Zavialov_-_Haskell_to_Core_-_Understanding_Haskell_Features_Through_Their_Desugaring-fty9QL4aSRc.mkv")
# (find-hstocorevideo "0:00")
# (find-hstocorevideo "1:51" "Hi everyone")
# (find-hstocorevideo "2:15" "desugaring definition ***")
# (find-hstocorevideo "3:12" "lexical analysis")
# (find-hstocorevideo "4:40" "name resolution")
# (find-hstocorevideo "5:12" "type checking")
# (find-hstocorevideo "5:30" "GHC pipeline")
# (find-hstocorevideo "6:14" "Haskell syntax")
# (find-hstocorevideo "7:01" "Haskell syntax 2: Expr.hs")
# (find-hstocorevideo "7:40" "browse the compiler GHC directory")
# (find-hstocorevideo "7:45" "core")
# (find-hstocorevideo "8:35" "pretend that core is a subset of Haskell")
# (find-hstocorevideo "9:01" "if you want to learn more")
# (find-hstocorevideo "9:14" "desugaring by example")
# (find-hstocorevideo "9:30" "Type information")
# (find-hstocorevideo "9:55" "function bindings")
# (find-hstocorevideo "10:33" "no separate type signatures")
# (find-hstocorevideo "11:13" "Multi-argument function bindings")
# (find-hstocorevideo "11:20" "all lambdas are single-argument")
# (find-hstocorevideo "11:56" "all lambdas are single-argument 2")
# (find-hstocorevideo "12:05" "pattern bindings")
# (find-hstocorevideo "13:18" "operator sections")
# (find-hstocorevideo "13:35" "pattern matching")
# (find-hstocorevideo "14:27" "pattern matching 2")
# (find-hstocorevideo "15:19" "lambda case")
# (find-hstocorevideo "15:28" "if-then-else")
# (find-hstocorevideo "15:39" "multi-way if")
# (find-hstocorevideo "15:44" "the seq function")
# (find-hstocorevideo "16:11" "bang patterns")
# (find-hstocorevideo "16:30" "parametric polymorphism")
# (find-hstocorevideo "17:16" "parametric polymorphism 2")
# (find-hstocorevideo "17:29" "the type argument and the value argument")
# (find-hstocorevideo "17:57" "parametric polymorphism 3")
# (find-hstocorevideo "18:13" "existential quantification ***")
# (find-hstocorevideo "20:12" "Classes (dictionary passing)")
# (find-hstocorevideo "21:00" "$dNum is a dictionaty that contains")
# (find-hstocorevideo "21:45" "Classes (dictionary passing) 2")
# (find-hstocorevideo "22:29" "do notation")
# (find-hstocorevideo "23:07" "do notation 2")
# (find-hstocorevideo "24:22" "Coercions and casts")
# (find-hstocorevideo "24:47" "Coercions and casts 2")
# (find-hstocorevideo "26:14" "Coercions and casts 3")
# (find-hstocorevideo "27:15" "GADTs")
# (find-hstocorevideo "29:37" "TypeFamilies")
# (find-hstocorevideo "30:36" "Coercions")
# (find-hstocorevideo "31:08" "Coercions")

return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b





#####
#
# haskell-report
# 2021jan14
#
#####

# «haskell-report»  (to ".haskell-report")
# https://www.haskell.org/documentation/
# (find-git-links "https://github.com/haskell/haskell-report" "haskellreport")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv ~/usrc/haskell-report/
cd      ~/usrc/
# git clone -b h2010 https://github.com/haskell/haskell-report
git   clone          https://github.com/haskell/haskell-report
cd      ~/usrc/haskell-report/

git clean -dfx
git reset --hard

export PAGER=cat
git branch --list -a
git for-each-ref
git log --oneline --graph --all -20

# (find-fline "~/usrc/")
# (find-fline "~/usrc/haskell-report/")
# (find-gitk  "~/usrc/haskell-report/")

# (code-c-d "haskellreport" "~/usrc/haskell-report/")
# (find-haskellreportfile "")
# (find-haskellreportfile "README")
# (find-haskellreportfile "report/README")
# (find-haskellreportfile "report/")
# (find-haskellreportfile "report/om")
# (find-haskellreportfile "report/decls.tex" "Datatype Renamings")
# (find-haskellreportfile "report/decls.verb" "Datatype Renamings")

cd ~/usrc/haskell-report/tools/
make |& tee om


cd ~/usrc/haskell-report/report/
patch haskell.verb <<'%%%'
10c10,12
< \usepackage[bookmarks=true]{hyperref}
---
> %\usepackage[bookmarks=true]{hyperref}
> \usepackage[colorlinks,citecolor=DarkRed,urlcolor=DarkRed]{hyperref} % (find-es "tex" "hyperref")
> \usepackage[x11names,svgnames]{xcolor} % (find-es "tex" "xcolor")
%%%

# (find-haskellreportfile "report/haskell.verb")

cd ~/usrc/haskell-report/report/
make |& tee om

# (find-fline    "~/usrc/haskell-report/report/")
# (find-pdf-page "~/usrc/haskell-report/report/classes.pdf")
# (code-pdf-page "haskellreport" "~/usrc/haskell-report/report/haskell.pdf")
# (code-pdf-text "haskellreport" "~/usrc/haskell-report/report/haskell.pdf" 20)
# (find-haskellreportpage)
# (find-haskellreporttext)
# (find-haskellreportpage 3 "Contents")
# (find-haskellreporttext 3 "Contents")
# (find-haskellreportpage (+ 20 43) "4.2.3    Datatype Renamings")
# (find-haskellreporttext (+ 20 43) "4.2.3    Datatype Renamings")




#####
#
# where
# 2021jan18
#
#####

# «where»  (to ".where")
# (find-huttonbookpage 37 "The layout rule" "where")
# (find-huttonbooktext 37 "The layout rule" "where")




#####
#
# foldr
# 2021jan18
#
#####

# «foldr»  (to ".foldr")
# (find-books "__comp/__comp.el" "haskell-hutton")
# (find-huttonbookpage 100 "7.3    The foldr function")
# (find-huttonbooktext 100 "7.3    The foldr function")
# (find-ghcfile "libraries/base/GHC/List.hs" "foldr1 f = go")
# (find-ghcfile "libraries/base/GHC/List.hs" "foldr2 k z = go")
# file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/src/GHC-Base.html#foldr
# (find-ghcfile "libraries/base/Data/Foldable.hs")
# (find-ghcsh "find * | sort")
# (find-ghcfile "")
# (find-ghcfile "libraries/base/")
# (find-ghcgrep "grep --color -nRH --null -e foldr libraries/base/*")
# (find-ghcgrep "grep --color -nRH --null -e 'foldr ' libraries/base/*")

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
foldr  (\a b -> "<"++a++b++">") "!" ["a", "b", "c", "d"]
** --> "<a<b<c<d!>>>>"
foldr1 (\a b -> "<"++a++b++">")     ["a", "b", "c", "d"]
** --> "<a<b<cd>>>"

foldl  (\a b -> "<"++a++b++">") "!" ["a", "b", "c", "d"]
** --> "<<<<!a>b>c>d>"
foldl1 (\a b -> "<"++a++b++">")     ["a", "b", "c", "d"]
** --> "<<<ab>c>d>"
foldl1 (\a b -> "<"++a++b++">")     ["a"]
** --> "a"




#####
#
# tuples
# 2021jan25
#
#####

# «tuples»  (to ".tuples")
# (find-ghcfile "libraries/base/Prelude.hs" "*** Tuples" "fst, snd")
# (find-ghcfile "libraries/base/Data/Tuple.hs" "fst (x,_)")
# (find-ghcfile "libraries/base/Data/Tuple.hs" "snd (_,y)")



#####
#
# Monomorphism restriction
# 2021jan26
#
#####

# «monomorphism-restriction»  (to ".monomorphism-restriction")
# https://wiki.haskell.org/Monomorphism_restriction
# https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-930004.5.5




#####
#
# translating the tree for (Ax)_1
# 2021jan27
#
#####

# «translating-Ax»  (to ".translating-Ax")
# (find-fline "~/LOGS/2021jan27.haskell")
# http://math.andrej.com/2012/12/25/free-variables-are-not-implicitly-universally-quantified/

atimes :: (b -> c) -> ((a,b) -> (a,c))
atimes btoc = abtoac where
  abtoac ab = ac where
    a = fst ab
    b = snd ab
    c = btoc b
    ac = (a,c)

--              [ab]^1
--              ------snd                     a = fst ab
--   [ab]^1        b        btoc              b = snd ab
--   ------fst     -------------app           c = btoc b
--     a                c                     ac = (a,c)
--     ------------------(,)                  abtoac = \ ab -> ac
--        ac                                  atimes = \ btoc -> abtoac
--     ------lambda
--     abtoac
--
--     ^atimes




#####
#
# lawvere
# 2021feb17
#
#####

# «lawvere»  (to ".lawvere")
# (find-git-links "https://github.com/jameshaydon/lawvere" "lawvere")






#####
#
# hoodle
# 2021sep23
#
#####

# «hoodle»  (to ".hoodle")
# https://github.com/wavewave/hoodle
# (find-git-links "https://github.com/wavewave/hoodle" "hoodle")
# (code-c-d "hoodle" "~/usrc/hoodle/")
# (find-hoodlefile "")
# (find-hoodlefile "xournal-parser/src/Text/Xournal/Parse/Conduit.hs")
# (find-hoodlefile "xournal-parser/src/Text/Xournal/Parse.hs")




#####
#
# libtinfo-missing
# 2021nov23
#
#####

# «libtinfo-missing»  (to ".libtinfo-missing")
# /home/edrx/.ghcup/ghc/8.8.4/lib/ghc-8.8.4/bin/ghc: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
# https://forum.cardano.org/t/error-127-installing-ghc-libtinfo-so-5-missing/60408

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti libtinfo5




#####
#
# music
# 2021dec20
#
#####

# «music»  (to ".music")
# https://news.ycombinator.com/item?id=29609395 The Haskell School of Music (2012) [pdf] (yale.edu)




#####
#
# calling-lua
# 2022jul14
#
#####

# «calling-lua»  (to ".calling-lua")
# (find-anggfile "HASKELL/Process1.hs")
# (find-ghc-links "System.Process")
# (find-ghcbasesh "find * | sort | grep 'System.Process'")
# (find-ghcbasesh "find * | sort | grep 'System'")

hi all! I draw most of my LaTeX diagrams using this -
http://angg.twu.net/dednat6/tug-slides.pdf - that is written in Lua,
and I realized that many diagrams that I need would be easier to draw
by using Haskell to generate Lua code... anyway, my beginner question
of the day is: how do I write a function in Haskell that runs an
external program with some input? for example, myfunction "foo" would
run something roughly equivalent to "echo 'foo' | luaprogram.lua" and
would return the output of that...

# (find-fline "~/LOGS/2022jul14.haskell" "you probably need uniq")

<[exa]> edrx: System.Process seems to have pretty well wrapped
        facilities
<[exa]> edrx: here
        https://hackage.haskell.org/package/process-1.6.14.0/docs/System-Process.html

# (find-sh "locate -i haskell")
# (find-sh "locate -i ghc")
# (find-sh "locate -i ghc | grep -i process")
# (find-sh "locate -i ghc | grep -i system")
# (find-sh "locate -i ghc | grep -i system | grep IO")
# (code-c-d "ghcprocess" "~/bigsrc/ghc-8.10.3/libraries/process/System/")
# (find-ghcprocessfile "")



#####
#
# System.IO
# 2022sep19
#
#####

# «System.IO»  (to ".System.IO")
# (find-sh "locate -i ghc | grep -i system | grep IO")
# (find-sh "locate -i ghc | grep -i system | grep Dire")
# (find-ghcsh "find * | sort | grep System | grep IO")
# (find-ghcsh "find * | sort | grep System | grep Directory")
# (find-ghcfile "libraries/base/System/IO.hs")
# (find-ghcfile "libraries/base/System/IO/")
# (find-ghcfile "libraries/directory/System/Directory.hs")
# (find-ghcfile "libraries/directory/System/Directory/")
# (find-hoogle "getCurrentDirectory")

module OCHS where
import System.IO
import System.Directory

writeFilein :: String -> IO ()
writeFilein xs = do 
                 curPath <- getCurrentDirectory
                 createDirectoryIfMissing False (curPath ++ "\\temp")
                 absPath <- makeAbsolute "\\temp"
                 writeFile (absPath ++ "\\in.txt") xs

readFileout :: IO ()
readFileout = do absPath <- makeAbsolute "\\temp\\out.txt"
                 xs <- (readFile' absPath)
                 print xs

# (find-sh "hoogle createDirectoryIfMissing")
# (find-sh "hoogle ++")
# (find-sh "hoogle ++ --count=2000")
# (find-sh "hoogle '(++)' --count=2000")



#####
#
# pipes
# 2022sep20
#
#####

# «pipes»  (to ".pipes")
# (find-cabal-links  "pipes")
# (find-cabal-unpack "pipes")
# (code-c-d "pipes" "~/usrc/pipes-4.3.16/")
# (find-pipesfile "")
# (find-pipesfile "src/Pipes.hs" "for ::")
# (find-pipesfile "src/Pipes/")
# (find-pipesfile "src/Pipes/Prelude.hs")
# (find-pipesfile "src/Pipes/Prelude.hs" "Use 'for' loops")
# (find-pipesfile "src/Pipes/Prelude.hs" "'Pipe' to a bidirectional 'Proxy'")
# (find-pipesfile "src/Pipes/Tutorial.hs")
# (find-pipesfile "src/Pipes/Tutorial.hs" "If you want a Quick Start")
# (find-pipesfile "src/Pipes/Tutorial.hs" "'Proxy' type")
# (find-pipesfile "tests/")
# (find-pipesfile "tests/Main.hs")

https://hackage.haskell.org/package/pipes-4.3.16/docs/Pipes-Tutorial.html
https://hackage.haskell.org/package/pipes-4.3.16/docs/Pipes-Core.html#t:Pipe
https://hackage.haskell.org/package/pipes-4.3.16/docs/Pipes-Prelude.html


# (find-books "__comp/__comp.el" "haskell-rw")
# (find-books "__comp/__comp.el" "haskell-rw" "Extended Example: Piping")
# (find-rwhaskellpage (+ 40 476)  "Extended Example: Piping")
# (find-rwhaskelltext (+ 40 476)  "Extended Example: Piping")
# (find-ghcsh "find * | sort | grep System | grep Process")
# (find-ghcsh "find * | sort | grep System | grep Posix")
# (find-ghcsh "find * | sort | grep System | grep -i Posix")
# (find-ghcfile "libraries/process/System/Process.hs")
# (find-ghcfile "libraries/process/System/Process/")
# (find-ghcfile "libraries/process/System/Process/Posix.hs")
# (find-ghcfile "libraries/unix/dist-install/build/System/Posix/Process.hs")
# (find-ghcsh "find * | sort | grep System | grep Pipes")

https://hackage.haskell.org/package/Pipe-1.0/docs/System-Process-Pipe.html

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cabal install pipes
cabal install conduit
cabal install machines

# (find-cabal-links "pipes")
# (find-cabal-links "conduit")
# (find-cabal-links "machines")

# (find-sh "eev-cabal cabal_tgz_unpack pipes")
# (find-sh "eev-cabal cabal_tgz_unpack conduit")
# (find-sh "eev-cabal cabal_tgz_unpack machines")
# (find-sh "eev-cabal cabal_tgz_unpack kan-extensions")
# (find-sh "eev-cabal cabal_tgz_unpack adjunctions")
# (find-sh "eev-cabal cabal_tgz_unpack profunctors")

# (code-c-d "pipes" "~/usrc/pipes-4.3.16/")
# (find-pipesfile "")

# (code-c-d "conduit" "~/usrc/conduit-1.3.4.2/")
# (find-conduitfile "")


particular fits into the ecosystem, see [the conduit
homepage](https://github.com/snoyberg/conduit#readme).

echo a b c ddd eee | cut -d' ' -f 2-3
# (find-man "cut")






#####
#
# kan-extensions
# 2022sep20
#
#####

# «kan-extensions»  (to ".kan-extensions")
# (find-cabal-links  "kan-extensions")
# (find-cabal-unpack "kan-extensions")
# (find-cabal-links  "adjunctions")
# (find-cabal-unpack "adjunctions")
# (find-cabal-links  "profunctors")
# (find-cabal-unpack "profunctors")
# http://github.com/ekmett/kan-extensions/
# http://github.com/ekmett/adjunctions/
# http://github.com/ekmett/profunctors/
# (code-c-d "kanextensions" "~/usrc/kan-extensions-5.2.5/")
# (code-c-d "adjunctions" "~/usrc/adjunctions-4.4.2/")
# (code-c-d "profunctors" "~/usrc/profunctors-5.6.2/")
# (find-kanextensionsfile "")
# (find-adjunctionsfile "")
# (find-profunctorsfile "")

# (find-kanextensionssh "find * | sort")
# (find-kanextensionsfile "src/Data/Functor/Yoneda.hs")







#####
#
# hsc2hs
# 2022sep20
#
#####

# «dist-install»  (to ".dist-install")
# «hsc2hs»       (to ".hsc2hs")
# (find-ghcfile "libraries/unix/dist-install/build/System/Posix/IO.hs")
# (find-ghcfile "libraries/unix/System/Posix/IO.hsc")
# (find-ghcfile "omh")
# (find-ghcfile "omh" "libraries/unix/./System/Posix/IO.hsc")
# (find-ghcfile "omh" "hsc2hs")
# (find-ghcfile "libraries/unix/")
# (find-ghcfile "libraries/unix/README.md")
# (find-ghcfile "omh" "hsc2hs")
# (find-sh "locate hsc2hs")
# (find-ghcfile "utils/hsc2hs/")
# (find-ghcfile "utils/hsc2hs/README.rst")
# (find-ghcfile "utils/hsc2hs/Main.hs")




#####
#
# Tagless-final style
# 2022sep15
#
#####

# «tagless»  (to ".tagless")
# https://okmij.org/ftp/meta-programming/index.html
# https://okmij.org/ftp/tagless-final/tagless-typed.html
# https://okmij.org/ftp/tagless-final/
# https://okmij.org/ftp/tagless-final/course/lecture.pdf
# https://okmij.org/ftp/tagless-final/JFP.pdf
# https://okmij.org/ftp/tagless-final/course/index.html#lecture
# https://okmij.org/ftp/typed-formatting/FPrintScan.html#DSL-In
# https://okmij.org/ftp/typed-formatting/FPrintScan.html#DSL-FIn
# https://okmij.org/ftp/tagless-final/#course-oxford
# https://markkarpov.com/tutorial/generics.html




#####
#
# AD.hs - Automatic Differentiation in 38 lines of Haskell
# 2022sep18
#
#####

# «AD.hs»  (to ".AD.hs")
https://news.ycombinator.com/item?id=32879734 Automatic Differentiation in 38 lines of Haskell (gist.github.com) ******
https://gist.github.com/ttesmer/948df432cf46ec6db8c1e83ab59b1b21
https://gist.github.com/ttesmer/948df432cf46ec6db8c1e83ab59b1b21#file-example-md
http://conal.net/papers/beautiful-differentiation/
http://conal.net/papers/beautiful-differentiation/beautiful-differentiation.pdf
http://conal.net/papers/beautiful-differentiation/beautiful-differentiation-long.pdf
http://conal.net/papers/beautiful-differentiation/beautiful-differentiation-slides.pdf
http://conal.net/blog/posts/paper-beautiful-differentiation
http://conal.net/talks/beautiful-differentiation.pdf

(code-pdf-page "bdslides" "$S/http/conal.net/papers/beautiful-differentiation/beautiful-differentiation-slides.pdf")
(code-pdf-text "bdslides" "$S/http/conal.net/papers/beautiful-differentiation/beautiful-differentiation-slides.pdf")
;; (find-bdslidespage)
;; (find-bdslidestext)



#####
#
# etags
# 2022sep18
#
#####

# «etags»  (to ".etags")
# (find-fline "~/LOGS/2022sep18.haskell")
# (find-fline "~/LOGS/2022sep18.haskell" "haskell etags")
# (find-fline "~/LOGS/2022sep18.haskell" "install ghcup, then")
# (to "cabal")

<sclv> https://hackage.haskell.org/package/hs-tags and
       https://hackage.haskell.org/package/hasktags are the two
       common tags generators iirc

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo apt-get install cabal
cabal update
cabal install hs-tags
cabal-install hs-tags



#####
#
# hasktags
# 2022sep21
#
#####

# «hasktags»  (to ".hasktags")
# (find-cabal-links  "hasktags")
# (find-cabal-unpack "hasktags")
# http://github.com/MarcWeber/hasktags
# (code-c-d "hasktags" "~/usrc/hasktags-0.72.0/")
# (find-hasktagsfile "")

# (find-fline "~/usrc/pipes-4.3.16/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/pipes-4.3.16/
hasktags --etags .
hasktags --etags

cd ~/usrc/pipes-4.3.16/src/
hasktags --etags .
laf

# (find-fline "~/usrc/pipes-4.3.16/src/")

# https://hackage.haskell.org/package/hasktags-0.72.0/docs/Hasktags.html#v:dirToFiles
# (find-fline "~/LOGS/2022sep21.haskell" "only scans the directory")



#####
#
# hs-tags
# 2022sep21
#
#####

# «hs-tags»  (to ".hs-tags")
# (find-cabal-links  "hs-tags")
# (find-cabal-unpack "hs-tags")




#####
#
# hoogle
# 2022sep18
#
#####

# «hoogle»  (to ".hoogle")
# (find-angg ".emacs" "hoogle")
# (find-cabal-links  "hoogle")
# (find-cabal-unpack "hoogle")
# (find-git-links "https://github.com/ndmitchell/hoogle" "hoogle")
# (code-c-d "hoogle" "~/usrc/hoogle-5.0.18.3/")
# (code-c-d "hoogle" "~/usrc/hoogle/")
# (find-hooglefile "")
# (find-hoogle "guard")

# (find-fline "~/LOGS/2022sep18.haskell" "https://hoogle.haskell.org")
# (find-angg "HASKELL/readwritefile.hs")
# https://hoogle.haskell.org/
# https://wiki.haskell.org/Hoogle
# https://github.com/ndmitchell/hoogle
# (find-hooglefile "")
# (find-hooglefile "docs/")
# (find-hooglefile "docs/Install.md")
# (find-hooglefile "docs/Install.md" "~/.hoogle/default.hoo")
# (find-hooglefile "docs/Install.md" "hoogle generate --local")
# (find-hooglefile "docs/Install.md" "### Emacs Integration")
# (find-hooglegrep "grep --color=auto -niRH --null -e emacs *")

(require 'haskell-mode)
(define-key haskell-mode-map "\C-ch" 'haskell-hoogle)
;(setq haskell-hoogle-command "hoogle")

<lambdabot> https://hoogle.haskell.org
<ski> @where hayoo
<lambdabot> http://hayoo.fh-wedel.de/ -- See also Hoogle:
            http://haskell.org/hoogle http://fpcomplete.com/hoogle

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-hooglefile "docs/Install.md" "hoogle generate --local")

cabal update
cabal install hoogle
hoogle generate --local
# (find-sh "hoogle --help")

# (find-fline "~/.hoogle/")




#####
#
# Defining a command ":hoogle" in ~/.ghci
# 2022oct08
#
#####

# «:def-hoogle»  (to ".:def-hoogle")
# (to ":def")
# (find-hooglefile "docs/Install.md" "### GHCi Integration")
# (find-angg ".ghci")

-- From: (find-es "haskell" ":def-hoogle")
-- See:  (find-es "haskell" ":def")
:def hoogle \x -> return $ ":!hoogle --count=2000 " ++ x

# (find-sh "hoogle map")
# (find-sh "hoogle map --count=2000")
# (find-sh "hoogle '(a -> b) -> [a] -> [b]' --count=2000")
# (find-hoogle "'(a -> b) -> [a] -> [b]'")

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:hoogle map




#####
#
# hayoo
# 2022sep20
#
#####

# «hayoo»  (to ".hayoo")
# (find-fline "~/LOGS/2022sep18.haskell" "@where hayoo")
# (find-cabal-links "Hayoo")


# (find-cabal-links "managed")
# (code-c-d "managed" "~/usrc/managed-1.0.9/")
# (find-managedfile "")




#####
#
# InstanceSigns
# 2022sep25
#
#####

# «InstanceSigns»  (to ".InstanceSigns")
# (find-ghcugdoc  "glasgow_exts#options-language")
# (find-ghcugdoc  "glasgow_exts#extension-InstanceSigs")
# (find-ghcugdocr "glasgow_exts#extension-InstanceSigs")
# (find-ghcugdocr "glasgow_exts#extension-InstanceSigs" ".. _instance-sigs:")

<lambdabot> ski said 12h 20m 22s ago: if you add a pragma line `{-#
            LANGUAGE InstanceSigs #-}' enabling that language
            extension, then you can write your method type
            signatures like `fmap :: (a -> b) -> (ST a ->
<lambdabot> ST b)' in your `instance' declarations without
            commenting them out. (for the infix operator `<*>'
            case, you will have to wrap the operator in brackets
            like `(<*>) :: ST (a -> b) -> (ST a -> ST b)')
<lambdabot> ski said 12h 15m 13s ago: it's also possible to use
            `fmap g (S st) = S (\s -> let .. = st s in ..)',
            matching on `S', rather than using `app', also for
            `(<*>)', and partially for `(>>=)' (unless you
<lambdabot> also use a `let' (or `case') also for the `f' call --
            but that might lose (?) the tail-call, which can be
            important)


#####
#
# template-haskell
# 2022sep26
#
#####

# «template-haskell»  (to ".template-haskell")
# (find-ghcugdoc "glasgow_exts#extension-TemplateHaskell")
# (find-ghcugdoc "8.10.1-notes#template-haskell")

https://wiki.haskell.org/Quasiquotation
https://stackoverflow.com/questions/70812567/quasiquotes-escaping
https://wiki.haskell.org/Template_Haskell
https://wiki.haskell.org/A_practical_Template_Haskell_Tutorial
https://en.wikipedia.org/wiki/Template_Haskell
https://www.stackage.org/package/template-haskell
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/meta-haskell.pdf



#####
#
# no-instance-for
# 2022oct01
#
#####

# «no-instance-for»  (to ".no-instance-for")
# https://mgsloan.com/posts/inspecting-haskell-instance-resolution/
# https://stackoverflow.com/questions/53622428/a-basic-monoid-definition-gives-no-instance-for-semigroup-mymonoid-arising-fr
# https://itecnote.com/tecnote/haskell-defining-a-new-monad-in-haskell-raises-no-instance-for-applicative/
# https://itecnote.com/tecnote/r-good-examples-of-not-a-functor-functor-applicative-monad/
# https://ericlippert.com/category/monads/
# https://ericlippert.com/2013/04/03/monads-part-thirteen/
# https://ericlippert.com/2013/04/02/monads-part-twelve/
# https://ericlippert.com/2013/03/28/monads-part-eleven/
# https://ericlippert.com/2013/03/25/monads-part-ten/
# https://ericlippert.com/2013/03/21/monads-part-nine/
# https://ericlippert.com/2013/03/18/monads-part-eight/
# https://ericlippert.com/2013/03/14/monads-part-seven/
# https://ericlippert.com/2013/03/11/monads-part-six/
# https://ericlippert.com/2013/03/07/monads-part-five/
# https://ericlippert.com/2013/02/28/monads-part-three/
# https://ericlippert.com/2013/02/25/monads-part-two/
# https://ericlippert.com/2013/02/21/monads-part-one/
# (find-fline "~/LOGS/2022oct01.haskell" "many programs backformed it")
# (find-fline "~/LOGS/2022oct01.haskell" "dictionary for that type")



#####
#
# Graph Reduction and STG
# 2022oct01
#
#####

$ «stg»  (to ".stg")
# «graph-reduction»  (to ".graph-reduction")
# https://en.wikipedia.org/wiki/Graph_reduction
# (find-fline "~/LOGS/2022oct01.haskell" "graph reduction")

https://stackoverflow.com/questions/11921683/understanding-stg
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GeneratedCode
https://wiki.haskell.org/Ministg
https://hackage.haskell.org/package/stgi
https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/generated-code

http://www.youtube.com/watch?v=UPy7TXgrK1A Screencast: The Haskell heap and the infinite list of primes



#####
#
# rewrite-rules
# 2022oct01
#
#####

# «rewrite-rules»  (to ".rewrite-rules")
# https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/rewrite_rules.html
# (find-ghcugdoc "glasgow_exts#pragma-RULES")
# (find-ghcugdocw "exts/rewrite_rules#rewrite-rules")
# (find-fline "~/LOGS/2022oct01.haskell" "rewrite rules")



#####
#
# ReadS
# 2022oct09
#
#####

# «ReadS»  (to ".ReadS")
# (find-fline "~/LOGS/2022oct09.haskell" "<ski> edrx : either `ReadS'")
# (find-ghc-links "ReadS")
# (find-ghcbasegrep "grep --color=auto -nRHw --null -e ReadS *")
# (find-ghcbasefile "Text/ParserCombinators/ReadPrec.hs")
# (find-ghcbasefile "Text/ParserCombinators/ReadP.hs")
# (find-ghcbasefile "GHC/Read.hs" "'ReadS' is mentioned")
# (find-ghcbasefile "Text/ParserCombinators/ReadP.hs" "type ReadS a")



https://www.haskellforall.com/2022/05/introductory-resources-to-type-theory.html?m=1
https://www.andres-loeh.de/LambdaPi/LambdaPi.pdf A tutorial implementation of a dependently typed LC
https://web.cecs.pdx.edu/~mpj/thih/thih.pdf Typing Haskell in Haskell
https://www.microsoft.com/en-us/research/wp-content/uploads/1997/01/henk.pdf Henk: a typed intermediate language




<ski> "On Understanding Types, Data Abstraction, and Polymorphism"
      by Luca Cardelli,Peter Wegner in 1985-12 at
      <http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf> ;
      "On Understanding Data Abstraction, Revisited" by William R.
      Cook in 2009-10 at
      <https://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf>

;; <cardelliwegner>
;; http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf
;; (find-fline "$S/http/lucacardelli.name/Papers/")
(code-pdf-page "cardelliwegner" "$S/http/lucacardelli.name/Papers/OnUnderstanding.A4.pdf")
(code-pdf-text "cardelliwegner" "$S/http/lucacardelli.name/Papers/OnUnderstanding.A4.pdf")
;; (find-cardelliwegnerpage)
;; (find-cardelliwegnertext)

;; <cookudar>
;; https://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf
;; (find-fline "$S/https/www.cs.utexas.edu/~wcook/Drafts/2009/")
(code-pdf-page "cookudar" "$S/https/www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf")
(code-pdf-text "cookudar" "$S/https/www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf")
;; (find-cookudarpage)
;; (find-cookudartext)




http://angg.twu.net/LATEX/2022-1-C2-infs-e-sups.pdf#page=7

Michael I. Schwartzbach: "Polymorphic Type Inference" (1995)
https://cs.au.dk/~amoeller/mis/typeinf.pdf
https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.57.1493




# (find-sh "locate -i prelude")
# (find-sh "locate -i prelude | grep -i ghc")

# (find-sh "w ghci")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
w ghci

# (find-status   "ghc")
# (find-vldifile "ghc.list")
# (find-udfile   "ghc/")

# (find-status   "ghc-doc")
# (find-vldifile "ghc-doc.list")
# (find-udfile   "ghc-doc/")




file:///usr/share/doc/ghc-doc/html/libraries/base-4.11.1.0/Prelude.html






http://www.cs.chalmers.se/~rjmh/citations/my_most_influential_papers.htm
http://www.cs.chalmers.se/~rjmh/afp-arrows.pdf
http://www.cs.chalmers.se/~rjmh/Papers/pretty.ps
http://www.cs.chalmers.se/~rjmh/Papers/arrows.pdf

http://homepages.inf.ed.ac.uk/wadler/topics/language-design.html


# Category Theory and Haskell:
# http://www.alpheccar.org/en/posts/show/74
# http://www.alpheccar.org/en/posts/show/76
# http://www.alpheccar.org/en/posts/show/77
# http://syntax.wikidot.com/blog:1
# http://www.cs.gunma-u.ac.jp/~hamana/Papers/cpo.pdf

http://www.comlab.ox.ac.uk/people/chris.heunen/publications/2008/arrows/arrows.pdf
http://www.comlab.ox.ac.uk/people/chris.heunen/publications/2006/arrows/arrows.pdf

http://www.khjk.org/log/2010/jul/getflag.html

http://www.haskell.org/haskell-symposium
http://www.loveshack.ukfsn.org/emacs/haskell-latex.el

http://blog.kfish.org/
http://blog.kfish.org/2010/05/monday-music-birk-by-kobi.html

http://goto.ucsd.edu/~rjhala/liquid/haskell/blog/blog/2013/01/01/refinement-types-101.lhs/

https://bartoszmilewski.com/2014/09/22/parametricity-money-for-nothing-and-theorems-for-free/ ***

http://newartisans.com/2017/05/monads-are-monoids/
https://medium.com/@krystal.maughan/breaking-the-space-time-barrier-with-haskell-time-traveling-and-debugging-in-codeworld-a-google-e87894dd43d7

http://www.philipzucker.com/a-sketch-of-gimped-interval-propagation-with-lenses/
https://github.com/philzook58/ad-lens/blob/master/src/Numeric/ADLens/Interval.hs

https://haskell.foundation/
https://mitchellwrosen.github.io/haskell-papers/

https://jrsinclair.com/articles/2019/what-i-wish-someone-had-explained-about-functional-programming/

http://euterpea.com/
http://learnyouahaskell.com/

https://hackage.haskell.org/package/network-3.1.1.1/docs/Network-Socket.html

https://typeclasses.com/phrasebook

<energizer> i am reading this post
            https://alessandrovermeulen.me/2013/07/13/the-difference-between-shallow-and-deep-embedding/

https://www.haskellforall.com/2022/05/introductory-resources-to-type-theory.html ***
https://hackage.haskell.org/package/containers-0.6.5.1/docs/src/Data.Map.Internal.html#line-4252 foldr = foldr

https://github.com/tomsmeding/ad-dualrev-th
# (find-git-links "https://github.com/tomsmeding/ad-dualrev-th" "addualrevth")
# (code-c-d "addualrevth" "~/usrc/ad-dualrev-th/")
# (find-addualrevthfile "")

https://github.com/VMatthijs/CHAD
# (find-git-links "https://github.com/VMatthijs/CHAD" "CHAD")
# (code-c-d "CHAD" "~/usrc/CHAD/")
# (find-CHADfile "")

https://wiki.haskell.org/IRC_channel @pl FUNCTION - shows a pointfree version of FUNCTION
https://wiki.haskell.org/Pointfree

http://learnyouahaskell.com/input-and-output pipes

https://wiki.haskell.org/Introduction_to_IO
https://www.vex.net/~trebla/haskell/IO.xhtml

<Axman6> _73:
         https://wiki.haskell.org/Regular_expressions_for_XML_Schema
<Axman6> I recently used this to implement regexes in our app, and
         it worked really well - it's such a beautiful
         implementation IMO

<ski> @type uncurry curry
<lambdabot> ((a, b) -> c, a) -> b -> c
<c_wraith> that function looks like a prank gone wrong
<ski> @type uncurry3 curry
<lambdabot> ((a, b) -> t4, a, b) -> t4
<ski> heh :)

<lambdabot> ski said 2d 2h 39m 55s ago: hm, i think i would either
            look into one of the `ListT' alternatives (including
            `LogicT') (possibly also using `MonadComprehensions'),
            see if i could insert `IO' or `
<lambdabot> StateT' or `WriterT' into that for the plotting; or try
            to go for `ContT' directly .. or else separate the plot
            stuff, doing it to the result of this comprehension
<lambdabot> ski said 2d 2h 38m 48s ago: well, the various streaming
            packages could possibly also be worthwhile to take a
            look at
<lambdabot> ski said 2d 2h 35m 42s ago: unrelated. you asked about
            `={...}=' notation for justifying equality reasoning
            steps earlier. i got that particular notation from
            (short paper, six pages) "Equality
<lambdabot> proofs in Cayenne" by augustss in 1999 at
            <https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.37.9415>

(find-books "__comp/__comp.el" "augustsson" "={ DEF }=")




#  Local Variables:
#  coding:               utf-8-unix
#  End: