Warning: this is an htmlized version!
The original is across this link,
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.
#
# 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/>.
#
#######





# «.haskell-docs»	(to "haskell-docs")
# «.comprehension»	(to "comprehension")
# «.hugs»		(to "hugs")
# «.entre»		(to "entre")
# «.nhc98»		(to "nhc98")
# «.haskore»		(to "haskore")
# «.sum_chars»		(to "sum_chars")
# «.runhugs»		(to "runhugs")
# «.thih»		(to "thih")
# «.parsec»		(to "parsec")
# «.yarrow»		(to "yarrow")
# «.ghc-deb»		(to "ghc-deb")
# «.gh»			(to "gh")
# «.epigram»		(to "epigram")
# «.ghc6»		(to "ghc6")
# «.multi-line»		(to "multi-line")
# «.agda2»		(to "agda2")
# «.binary-0.3»		(to "binary-0.3")
# «.happy-and-alex»	(to "happy-and-alex")
# «.zlib-0.3»		(to "zlib-0.3")
# «.eepitch-hugs»	(to "eepitch-hugs")
# «.haskell-mode»	(to "haskell-mode")
# «.daume-yaht»		(to "daume-yaht")
# «.xmonad»		(to "xmonad")
# «.xmonad-rcfile»	(to "xmonad-rcfile")
# «.escape-from-zurg»	(to "escape-from-zurg")
# «.luautils»		(to "luautils")
# «.real-world-haskell»	(to "real-world-haskell")
# «.distributivity»	(to "distributivity")




#####
#
# Haskell docs
# 2011nov17
#
#####

# «haskell-docs»  (to ".haskell-docs")
# (find-angg ".emacs" "haskell")
# (find-status   "haskell-doc")
# (find-vldifile "haskell-doc.list")
# (find-udfile   "haskell-doc/")
# (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-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-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



#####
#
# 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 "")






# (find-status "hugs-doc")
# (find-vldifile "hugs-doc.list")
# (find-fline "/usr/doc/hugs-doc/")
# (find-w3 "/usr/doc/hugs-doc/index.html")


pdsc $SDEBIAN/dists/potato/main/source/doc/haskell-doc_19991028-1.dsc







#####
#
# 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:")







#####
#
# nhc98
# 2001feb14
#
#####

# «nhc98»  (to ".nhc98")
#*
rm -Rv /usr/src/nhc98-1.02/
cd /usr/src/
tar -xvzf $S/ftp/ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98src-1.02.tar.gz
cd /usr/src/nhc98-1.02/
./configure	|& tee oc
make		|& tee om
#*





####
#
# Haskore
# 99nov27 / 00feb01
#
####

# «haskore»  (to ".haskore")
gv /usr/src/haskore/Docs/tutorial.ps &
#*
rm -Rv /usr/src/haskore/
mkdir /usr/src/haskore/
cd /usr/src/haskore/
unzip $S/http/www.haskell.org/haskore/Haskore.zip
mv Src/SSF.LHS Src/Ssf.lhs

patch -p0 Src/TestHaskore.lhs <<'---'
93a94,97
> > timidity = do
> >          system "timidity test.mid"
> >          return ()
> 
---

#*
# (find-hkorefile "Src/TestHaskore.lhs" "testLinux m = do")
diff Src/TestHaskore.lhs~ Src/TestHaskore.lhs | tee ~/o

#*
cd /usr/src/haskore/Src/
cat > $EEG <<'---'
t0
timidity
---
eeg hugs HaskoreExamples.lhs

#*
# (code-c-d "hkore" "/usr/src/haskore/")
# (find-hkorefile "")
# (find-hkorefile "Readme" "Haskore.lhs")
# (find-hkorefile "Src/")

# (find-hkorefile "Src/TestHaskore.lhs" "testLinux m = do")
# (find-hkorefile "Src/TestHaskore.lhs" "testLinux m = do")

# (find-fline "/usr/include/linux/soundcard.h")
# (find-fline "/usr/include/midi.h")






#####
#
# 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")





#####
#
# hbc 0.9999.4
#
#####

#*
cd /usr/src/
rm -Rv hbc
mkdir hbc
cd /usr/src/hbc/
tar -xvzf /snarf/ftp/ftp.cs.chalmers.se/pub/haskell/chalmers/hbc-0.9999.4.src.tar.gz
# tar -xvzf /snarf/ftp/ftp.cs.chalmers.se/pub/haskell/chalmers/hbc-0.9999.4.bin-i386-linuxELF.tar.gz

cd /usr/src/hbc/
find -name '*.[ch]' > .files.ch

#*
# (find-hbcfile "README" 40)
cd /usr/src/hbc/src/
rm config.status
#
cat > $EEG <<'---'
m_80386
linux
gcc
n
y
n
y
y
n
n
/usr/src/hbc/bin
/usr/src/hbc/lmlc
/usr/local/man/man1
---
eeg ./configure
#
make universe |& tee ../omu
#*

# (find-hbcfile "src/bin/mycc")

for i in lmlc hbc lmlmake hbcmake hp2ps addsign hbcaddsign hbcgrep
do ln -v -s /usr/src/hbc/bin-i386-linuxELF/exe/$i /usr/bin/$i
done

for i in lmlc hbc lmlmake hbcmake hp2ps addsign hbcaddsign hbcgrep
do rm /usr/bin/$i
done




#####
#
# 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




#####
#
# HaskellDB
#
#####

# (find-fline "$S/http/haskell.systemsz.cs.yale.edu/haskellDB/download/core.zip")
lynx /snarf/http/haskell.systemsz.cs.yale.edu/haskellDB/index.html




#####
#
# 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)
%%%

#*




#####
#
# haskell-mode
#
#####

# (find-fline "/snarf/http/www.haskell.org/haskell-mode/haskell-mode.tar.gz")
# (find-enode "Top")
# (find-elnode "Top" "\nLoading\n")
# (find-node "(elisp)How Programs Do Loading")

(setq load-path (append load-path '("/usr/src/haskell-mode")))

rm -Rv /usr/src/haskell-mode/
mkdir  /usr/src/haskell-mode/
cd     /usr/src/haskell-mode/
tar -xvzf /snarf/http/www.haskell.org/haskell-mode/haskell-mode.tar.gz

# (code-c-d "hmode" "/usr/src/haskell-mode/")
# (find-hmodefile "")
# (find-hmodefile "haskell-mode.el")

# load-path
("/usr/lib/emacs/site-lisp/w3" "/usr/share/emacs19/site-lisp/mew" "/etc/emacs19" "/etc/emacs" "/usr/local/share/emacs/19.34/site-lisp" "/usr/local/share/emacs/site-lisp" "/usr/share/emacs/19.34/site-lisp" "/usr/share/emacs/site-lisp" "/usr/share/emacs/19.34/lisp")




######
#
# hbc 0.9999.4
#
######

cd /usr/src/
rm -Rv hbc
mkdir hbc
cd /usr/src/hbc/
tar -xvzf /snarf/ftp/ftp.cs.chalmers.se/pub/haskell/chalmers/hbc-0.9999.4.src.tar.gz
tar -xvzf /snarf/ftp/ftp.cs.chalmers.se/pub/haskell/chalmers/hbc-0.9999.4.bin-i386-linuxELF.tar.gz

cd /usr/src/hbc/
find -name '*.[ch]' > .files.ch

# (find-hbcfile "README" 40)

cd /usr/src/hbc/src/
rm config.status
#
./configure <<EOF
m_80386
linux
gcc
n
y
n
y
y
n
n
/usr/src/hbc/bin
/usr/src/hbc/lmlc
/usr/local/man/man1
EOF
#
make universe |& tee ../omu

# (find-hbcfile "src/bin/mycc")




for i in lmlc hbc lmlmake hbcmake hp2ps addsign hbcaddsign hbcgrep
do ln -v -s /usr/src/hbc/bin-i386-linuxELF/exe/$i /usr/bin/$i
done

for i in lmlc hbc lmlmake hbcmake hp2ps addsign hbcaddsign hbcgrep
do rm /usr/bin/$i
done




#######
#
# LL(1) parser
#
#######

# (find-fline "$S/http/www.cs.uu.nl/groups/ST/Software/Parse/UU_Parsing.tar.gz"
)



######
#
# JPEG spec: paper + gofer program
#
######

psne http://www.cs.uu.nl/people/jeroen/article/jpeg/jpeg.ps.gz
psne http://www.cs.uu.nl/people/jeroen/article/jpeg/jpeg.gs





######
#
# TkHaskell (old)
#
######

psne http://www.dcs.gla.ac.uk/~nww/TkHaskell/TkHaskellManual.ps.gz
psne http://www.dcs.gla.ac.uk/~nww/TkHaskell/examples.tar.gz

gv /snarf/http/www.dcs.gla.ac.uk/~nww/TkHaskell/TkHaskellManual.ps &
cd /snarf/http/www.dcs.gla.ac.uk/~nww/TkHaskell/

tar -tvzf /snarf/http/www.dcs.gla.ac.uk/~nww/TkHaskell/examples.tar.gz
cd /snarf/http/www.cs.uu.nl/people/jeroen/article/jpeg/

#
# Etc:
#

http://www.cs.ucc.ie/~dornan/TkHaskell.tar.gz
http://www.informatik.uni-ulm.de/abt/pm/ftp/tkgofer.html
ftp://ftp.informatik.uni-ulm.de/pub/PM/TkGofer2.0/tkgofer2.0.tar.gz
http://www.cse.ogi.edu/~nday/Tools/hpp/hpp.html
http://www.cse.ogi.edu/~nday/Tools/Fuss/fuss.html
http://www.cse.ogi.edu/~jl/jokes.html

http://haskell.systemsz.cs.yale.edu/haskellscript/




######
#
# haskell-mode
#
######

pdsc $SDEBIAN/dists/potato/main/source/devel/haskell-mode_1.2-1.dsc
cd /usr/src/haskell-mode-1.2/
debian/rules binary	|& tee odrb

cd /usr/src/
mv -v haskell-mode*.deb .debs

cd /usr/src/.debs/
dpkg-scanpackages . /dev/null | tee Packages
apt-get update

apt-get install haskell-mode

# (find-vldifile "haskell-mode.list")







######
#
# TclHaskell (sep/99)
#
######

rm -Rv /usr/src/TclHaskell/
cd /usr/src/
tar -xvzf $S/http/www.dcs.gla.ac.uk/~meurig/TclHaskell/TclHaskell.tar.gz
cd /usr/src/TclHaskell/

cd src/
make XINC=/usr/X11R6/include XLIB=/usr/X11R6/lib \
  TclPrim.so |& tee om

cd /usr/src/TclHaskell/demo/
expect -c '
  spawn /usr/local/bin/hugs -P[join {
    /usr/src/TclHaskell/src
    /usr/local/share/hugs/lib
    /usr/local/share/hugs/lib/hugs
    /usr/local/share/hugs/lib/exts
  } ":"] Demo.hs
  expect "Main>"
  send "main\n"
  interact
'

# (find-THfile "")
# (find-THfile "Readme.txt" "TclPrim.so")
# (find-THfile "src/")
# (find-THfile "src/makefile")
# (find-THfile "bin/tclexe")
# (find-THfile "demo/")
# (find-THfile "doc/")

lynx /usr/src/TclHaskell/doc/usermanual.html

(export TK_LIBRARY=/usr/lib/tk8.0/
 export TCL_LIBRARY=/usr/lib/tcl8.0/
 hugs)


# (code-c-d "TH" "/usr/src/TclHaskell/")
# (find-THfile "")
# (find-THfile "src/" "makefile")





#####
#
# Typing Haskell in Haskell
#
#####

# «thih»  (to ".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 4.08.1 deb
# 2001may06
#
#####

# «ghc-deb»  (to ".ghc-deb")
# (find-status "ghc4")
# (find-vldifile "ghc4.list")
# (find-fline "/usr/share/doc/ghc4/")
#*
cd $S/http/www-i2.informatik.rwth-aachen.de/Software/Haskell/debian/
dpkg -i potato/binary-i386/devel/ghc4_4.08.1-4.1potato.deb

cd $S/http/www-i2.informatik.rwth-aachen.de/Software/Haskell/debian/
# dpkg -i potato/binary-i386/libs/libgmp3_3.1.1-3.1potato.deb

cd /
debtarxvzf $S/http/www-i2.informatik.rwth-aachen.de/Software/Haskell/debian/potato/binary-i386/libs/libgmp3_3.1.1-3.1potato.deb './usr/lib/*'
#*



#####
#
# 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".





#####
#
# ghc6
# 2007nov20
#
#####

# «ghc6»  (to ".ghc6")
# (find-blogme3 "angglisp.lua" "ghcdoc")
# (find-status   "ghc6")
# (find-vldifile "ghc6.list")
# (find-udfile   "ghc6/")
# (find-zsh "availabledebs | sort" "ghc6")
# (find-status   "ghc6-doc")
# (find-vldifile "ghc6-doc.list")
# (find-udfile   "ghc6-doc/")
# (code-c-d "ghcdoc" "/usr/share/doc/ghc6-doc/html/")
# (code-c-d "ghcusrh" "/usr/share/doc/ghc6-doc/html/users_guide/")
# (find-ghcdocfile "")
# (find-ghcdocfile "users_guide/")
# (find-ghcdocw3m "users_guide/index.html")
# (find-ghcdocw3m "users_guide/ghci-invocation.html")
# (find-ghcdocw3m "users_guide/packages.html")

# (find-ghcusrhw3m "index.html")
# (find-ghcusrhw3m "ghci.html")
# (find-ghcusrhw3m "ghci.html#ghci-introduction")
# (find-ghcusrhw3m "loading-source-files.html")
# (find-ghcusrhw3m "packages.html")
# (find-ghcusrhw3m "monomorphism.html")

# (find-h98rephw3m "decls.html#monomorphism")
# (find-h98rephw3m "decls.html#sect4.5.5")

# (find-ghcusrhw3m "index.html")
# (find-ghcusrhw3m "ghci.html")
# (find-ghcusrhw3m "ghci-commands.html")

# (find-sh "ghc --help")
# (find-sh "ghc-pkg --help")
# (find-sh "ghc-pkg list")

* (eepitch-ghci)
* (eepitch-kill)
* (eepitch-ghci)
:?
:quit




#####
#
# 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)






#####
#
# Agda2
# 2007nov20
#
#####

# «agda2»  (to ".agda2")
# (find-es "agda")
# (find-fline "~/LOGS/2007nov20.haskell" "Agda2")
# http://appserv.cs.chalmers.se/users/ulfn/wiki/agda.php
# http://www.cs.chalmers.se/~ulfn/darcs/Agda2/Agda-2.1.2.tar.gz
#*
rm -Rv ~/usrc/Agda2/
tar -C ~/usrc/ -xvzf \
  $S/http/www.cs.chalmers.se/~ulfn/darcs/Agda2/Agda-2.1.2.tar.gz
cd     ~/usrc/Agda2/

#*
# (code-c-d "agda2" "~/usrc/Agda2/")
# (find-agda2file "")
# (find-agda2file "README")
# It needs two ghc packages: binary-0.3 and zlib-0.3.




#####
#
# binary-0.3
# 2007nov20
#
#####

# «binary-0.3»  (to ".binary-0.3")
# http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3
# http://hackage.haskell.org/packages/archive/binary/0.3/binary-0.3.tar.gz
#*
rm -Rv ~/usrc/ghc/binary-0.3/
mkdir  ~/usrc/ghc/
tar -C ~/usrc/ghc/ -xvzf \
  $S/http/hackage.haskell.org/packages/archive/binary/0.3/binary-0.3.tar.gz
cd     ~/usrc/ghc/binary-0.3/

#*
# (code-c-d "ghcbinary" "~/usrc/ghc/binary-0.3/")
# (find-ghcbinaryfile "")
# (find-ghcbinaryfile "README")

* (eepitch-shell)
cd     ~/usrc/ghc/binary-0.3/
runhaskell Setup.lhs configure   |& tee orsc
runhaskell Setup.lhs build       |& tee orsb
runhaskell Setup.lhs install     |& tee orsi

# (find-ghcbinaryfile "orsc")
# (find-ghcbinaryfile "orsb")
# (find-ghcbinaryfile "orsi")

# From orsc:
#   Configuring binary-0.3...
#   configure: /usr/bin/ghc-pkg
#   configure: Dependency base-any: using base-2.0
#   configure: Using install prefix: /usr/local
#   configure: Binaries installed in: /usr/local/bin
#   configure: Libraries installed in: /usr/local/lib/binary-0.3/ghc-6.6
#   configure: Private binaries installed in: /usr/local/libexec
#   configure: Data files installed in: /usr/local/share/binary-0.3
# How do I change the prefix to ~/usrc/ghc/ ?




#####
#
# Happy and Alex
# 2007nov20
#
#####

# «happy-and-alex»  (to ".happy-and-alex")
# (find-status   "happy")
# (find-vldifile "happy.list")
# (find-udfile   "happy/")
# (find-status   "alex")
# (find-vldifile "alex.list")
# (find-udfile   "alex/")




#####
#
# zlib-0.3
# 2007nov20
#
#####

# «zlib-0.3»  (to ".zlib-0.3")
# http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib-0.3
# http://hackage.haskell.org/packages/archive/zlib/0.3/zlib-0.3.tar.gz
#*
rm -Rv ~/usrc/ghc/zlib-0.3/
mkdir  ~/usrc/ghc/
tar -C ~/usrc/ghc/ -xvzf \
  $S/http/hackage.haskell.org/packages/archive/zlib/0.3/zlib-0.3.tar.gz
cd     ~/usrc/ghc/zlib-0.3/

#*
# (code-c-d "ghczlib" "~/usrc/ghc/zlib-0.3/")
# (find-ghczlibfile "")




#####
#
# 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
# 2008may23
#
#####

# «haskell-mode»  (to ".haskell-mode")
# (find-angg ".emacs" "haskell-mode")
# (find-status   "haskell-mode")
# (find-vldifile "haskell-mode.list")
# (find-udfile   "haskell-mode/")
# (find-fline "/etc/emacs/site-start.d/50haskell-mode.el")
# (code-c-d "haskellmode" "/usr/share/emacs/site-lisp/haskell-mode/")
# (find-haskellmodefile "haskell-hugs.el")
# (find-haskellmodefile "inf-haskell.el")
# (find-haskellmodefile "")

# http://projects.haskell.org/haskellmode-emacs/
# http://projects.haskell.org/haskellmode-emacs/haskell-mode-2.8.0.tar.gz
#*
rm -Rv ~/usrc/haskell-mode-2.8.0/
tar -C ~/usrc/ -xvzf \
  $S/http/projects.haskell.org/haskellmode-emacs/haskell-mode-2.8.0.tar.gz
cd     ~/usrc/haskell-mode-2.8.0/

#*
# (code-c-d "haskellmode" "~/usrc/haskell-mode-2.8.0/")
# (find-haskellmodefile "")
# (find-haskellmodefile "README")

;; (find-haskellmodefile "inf-haskell.el" "haskell-program-name")
;; (setq haskell-program-name "hugs \"+.\"")
(setq haskell-program-name "ghci")

(add-to-list 'load-path "~/usrc/haskell-mode-2.8.0/")
(load "~/usrc/haskell-mode-2.8.0/haskell-site-file")

(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

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







#####
#
# 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



#####
#
# Real world Haskell
# 2013jan23
#
#####

# «real-world-haskell» (to ".real-world-haskell")
# http://book.realworldhaskell.org/read/types-and-functions.html





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

# «distributivity» (to ".distributivity")
# 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)





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/ ***




#  Local Variables:
#  coding:               raw-text-unix
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  End: