Alessandro Vermeulen avatar Alessandro Vermeulen committed ad97c6b

* Work on paper bit
* Started implementing the Memo table from Stretching.

Comments (0)

Files changed (11)

 *.log
 *.pdf
 *.ptb
+*.out
+*.bbl
+*.blg
 .DS_Store
 .svn
 *.fmt
+paper.print.tex
+paper.screen.tex
 plan/memo.tex
 README.html

code/Memo/Main.hs

+module Main where
+  
+import Memo.SNMap.SNMap
+
+main = print "Hello :)"

code/Memo/SNMap/SNMap.hs

+module Memo.SNMap.SNMap where
+
+import System.Mem.Weak
+import System.Mem.StableName
+
+applyWeak :: (a -> b) -> SNMap a (Weak b) -> a -> b
+applyWeak f table arg =
+  unsafePerformIO (do
+    { sn  <- mkStableName arg
+    ; lkp <- lookupSNMap tbl sn
+    ; case lkp of
+        Nothing    -> not_found tbl sn
+        Just weak  -> do { val <- deRefWeak weak
+                         ; case val of 
+                             Just result  -> return result
+                             Nothing      -> return not_found tbl sn
+                         }
+    })
+  where
+    not_found tbl sn = do { let res = f arg
+                          ; weak <- mkSimpleWeak arg res
+                          ; insertSNMap tbl sn weak
+                          ; return res
+                          }
Add a comment to this file

code/Memo/Tries/Conal.hs

Empty file added.

Add a comment to this file

code/Memo/Tries/Ralf.hs

Empty file added.

+\documentclass[a4paper,11pt]{article}
+\usepackage[english]{babel}
+\usepackage[sort&compress]{natbib}
+\usepackage{hyperref, fancyhdr} 
+\usepackage{verbatim , parskip}
+\usepackage{amsmath}
+
+
+\frenchspacing
+
+\pagestyle{fancy}
+\def\mytitle{Dead-code elimination for a functional language}
+\def\myauthor{Alessandro Vermeulen, Johan Jeuring\\ Utrecht University, 2011.}
+
+\title{\mytitle}
+\author{\myauthor}
 all: doc
 
-doc: paper.lhs references.bib
-	lhs2TeX-hl -o paper.fmt paper.lhs && lhs2TeX -o paper.tex paper.lhs && pdflatex paper.tex && bibtex paper && pdflatex paper.tex && pdflatex paper.tex
+doc: fmt screen print
+	
+fmt: paper.lhs
+	lhs2TeX-hl -o paper.fmt paper.lhs
+	
+screen:
+	lhs2TeX -o paper.screen.tex paper.screen.lhs && pdflatex paper.screen.tex && bibtex paper.screen && pdflatex paper.screen.tex && pdflatex paper.screen.tex
+	
+print:
+	lhs2TeX -o paper.print.tex paper.print.lhs && pdflatex paper.print.tex && bibtex paper.print && pdflatex paper.print.tex && pdflatex paper.print.tex
-\documentclass[a4paper,11pt]{article}
-\usepackage[english]{babel}
-\usepackage[sort&compress]{natbib}
-\usepackage{color , hyperref , tikz} 
-\usepackage{verbatim , parskip, fullpage}
-\usepackage{amsmath}
-\usepackage{alltt}
+\begin{document}
+\fancyhead{}
+\fancyfoot{}
 
-\definecolor{syntax}{RGB}{0, 0, 0}
-\definecolor{datatype}{RGB}{196, 6, 11}
-\definecolor{class}{RGB}{168,37,39}
-\definecolor{fieldname}{RGB}{0,0,162}
-\definecolor{prelude}{RGB}{64,80,117}
-\definecolor{numeral}{RGB}{0,0,205}
-\definecolor{infixoperator}{RGB}{19, 19, 168}
-\definecolor{constructor}{RGB}{196, 6, 11}
-\definecolor{keyword}{RGB}{4, 58, 252}
-\definecolor{special1}{RGB}{159,138,0}
-\definecolor{string}{RGB}{3, 106, 7}
-\definecolor{char}  {RGB}{3, 106, 7}
-
-
-%include lhs2TeX.fmt
-%include paper.fmt
-%subst char a    	= "\color{char}\text{\tt ''" a "''}"
-%subst string a  	= "\color{string}\text{\tt \char34 " a "\char34}"
-%subst numeral a =  "\color{numeral}{ " a " }"
-
-\newcommand{\hKeyword}[1]{\textbf{\color{steelblue}{#1}}}
-\newcommand{\hChar}[1]{\textbf{#1}}
-\newcommand{\hString}[1]{\textbf{#1}}
-\newcommand{\hNumeral}[1]{\textbf{#1}}
-
-\def\mytitle{Dead-code elimination for a functional language}
-
-\def\myauthor{Alessandro Vermeulen, Johan Jeuring\\ Utrecht University, 2011.}
-
-\title{\mytitle}
-\author{\myauthor}
-
-
-\frenchspacing
-\definecolor{steelblue}{RGB}{3,46,135}
-\hypersetup{pdftitle=\mytitle,pdfauthor=\myauthor,linkcolor=steelblue}
-\hypersetup{colorlinks=true}
-
-\begin{document}
+\fancyhead[LE,RO]{\slshape \rightmark}
+\fancyhead[LO,RE]{\slshape \thepage\ - \leftmark}
+\fancyfoot[C]{}
   
 \maketitle
 
+
+
 \section{Introduction}
 
   \subsection{Research question}
+  The goal is first to be able to \emph{generically} memoise functions by using
+  either |memo :: (a -> b) -> (a->b)| or |memoFix :: ((a -> b) -> (a -> b)) ->
+  (a -> b)| that respectively memoise functions non-recursively and recursively.
+  
+  Secondly the goal is to implement pragma-driven memoisation in UHC (cite). And
+  at last check whether the introduction of the memo-fix operator has any impact
+  on optimisations.
   
 \section{Previous work}
-\cite{Hinze00memofunctions}
+\cite{Hinze00memofunctions}, \cite{Jones99stretchingthe}, and
+\cite{Kiselyov10funwith}
 
 \section{Our contribution}
 
+  \subsection{Generic Memoisation}
+  
+  \subsection{Implementation in UHC}
+  
+  \subsection{Effect analysis}
+
 \section{Future work}
 
 \section{Conclusion}

paper/paper.print.lhs

+\input{common.tex}
+
+%include lhs2TeX.fmt
+%include paper.fmt
+%subst char a    	= "\color{char}\text{\tt ''" a "''}"
+%subst string a  	= "\color{string}\text{\tt \char34 " a "\char34}"
+%subst numeral a =  "\color{numeral}{ " a " }"
+
+\newcommand{\lhsCHsyntax}[1]{{{#1}}}
+\newcommand{\lhsCHfunction}[1]{{{#1}}}
+\newcommand{\lhsCHinfixoperator}[1]{{{#1}}}
+\newcommand{\lhsCHprelude}[1]{{\mathbf{#1}}}
+\newcommand{\lhsCHkeyword}[1]{{\textbf{#1}}}
+\newcommand{\lhsCHconstructor}[1]{{\textbf{#1}}}
+\newcommand{\lhsCHtype}[1]{{{#1}}}
+\newcommand{\lhsCHclass}[1]{{{#1}}}
+
+\hypersetup{pdftitle=\mytitle,pdfauthor=\myauthor}
+\hypersetup{colorlinks=false}
+
+%include paper.lhs

paper/paper.screen.lhs

+\input{common.tex}
+\usepackage{color}
+\definecolor{syntax}{RGB}{0, 0, 0}
+\definecolor{datatype}{RGB}{196, 6, 11}
+\definecolor{class}{RGB}{168,37,39}
+\definecolor{fieldname}{RGB}{0,0,162}
+\definecolor{prelude}{RGB}{64,80,117}
+\definecolor{numeral}{RGB}{0,0,205}
+\definecolor{infixoperator}{RGB}{19, 19, 168}
+\definecolor{constructor}{RGB}{196, 6, 11}
+\definecolor{keyword}{RGB}{4, 58, 252}
+\definecolor{special1}{RGB}{159,138,0}
+\definecolor{string}{RGB}{3, 106, 7}
+\definecolor{char}  {RGB}{3, 106, 7}
+
+
+%include lhs2TeX.fmt
+%include paper.fmt
+%subst char a    	= "\color{char}\text{\tt ''" a "''}"
+%subst string a  	= "\color{string}\text{\tt \char34 " a "\char34}"
+%subst numeral a =  "\color{numeral}{ " a " }"
+
+\newcommand{\lhsCHsyntax}[1]{\color{syntax}{{#1}}}
+\newcommand{\lhsCHfunction}[1]{\color{infixoperator}{{#1}}}
+\newcommand{\lhsCHinfixoperator}[1]{\color{infixoperator}{{#1}}}
+\newcommand{\lhsCHprelude}[1]{\color{prelude}{\mathbf{#1}}}
+\newcommand{\lhsCHkeyword}[1]{\color{keyword}{\textbf{#1}}}
+\newcommand{\lhsCHconstructor}[1]{\color{constructor}{\textbf{#1}}}
+\newcommand{\lhsCHtype}[1]{\color{datatype}{{#1}}}
+\newcommand{\lhsCHclass}[1]{\color{class}{{#1}}}
+
+\definecolor{steelblue}{RGB}{3,46,135}
+\hypersetup{pdftitle=\mytitle,pdfauthor=\myauthor,linkcolor=steelblue}
+\hypersetup{colorlinks=true}
+
+%include paper.lhs

paper/references.bib

+@INPROCEEDINGS{Hinze00memofunctions,
+    author = {Ralf Hinze},
+    title = {Memo Functions, Polytypically!},
+    booktitle = {Proceedings of the 2nd Workshop on Generic Programming, Ponte de},
+    year = {2000},
+    pages = {17--32}
+}
+@MISC{Kiselyov10funwith,
+    author = {Oleg Kiselyov and Simon Peyton and Jones Chung-chieh Shan},
+    title = {Fun with type functions},
+    year = {2010}
+}
+@MISC{Jones99stretchingthe,
+    author = {Simon Peyton Jones and Simon Marlow and Conal Elliott},
+    title = {Stretching the storage manager: weak pointers and stable names in Haskell},
+    year = {1999}
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.