Skip to content

Instantly share code, notes, and snippets.

@hmemcpy
Created September 22, 2018 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmemcpy/d428f4580fa6bdd74e0d2618da4b372f to your computer and use it in GitHub Desktop.
Save hmemcpy/d428f4580fa6bdd74e0d2618da4b372f to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{minted}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{libertine}
\defaultfontfeatures{
Scale=MatchLowercase,
}
\setmonofont[BoldFont={Inconsolata LGC Bold}]{Inconsolata LGC}
\usemintedstyle{default}
\setminted[scala]{fontsize=\footnotesize}
\setminted[haskell]{fontsize=\footnotesize}
\newenvironment{haskell}{
\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,fill=blue!20]
{\scriptsize\strut \texttt{Haskell}};}
}
\mdfsetup{innertopmargin=0pt,linecolor=blue!20,%
linewidth=1pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\VerbatimEnvironment
\begin{mdframed}\begin{minted}{haskell}}{\end{minted}\end{mdframed}}
\newenvironment{scala}{
\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=green!20]
{\scriptsize\strut \texttt{Scala}};}
}
\mdfsetup{innertopmargin=0pt,linecolor=green!20,%
linewidth=1pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\VerbatimEnvironment
\begin{mdframed}\begin{minted}{scala}}{\end{minted}\end{mdframed}}
\begin{document}
\begin{haskell}
factorizer :: (c -> a) -> (c -> b) -> (c -> (a, b))
factorizer p q = \x -> (p x, q x)
\end{haskell}
\begin{scala}
def factorizer[A, B, C]: (C => A) => (C => B) => (C => (A, B)) =
p => q => x => (p(x), q(x))
\end{scala}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment