Skip to content

Instantly share code, notes, and snippets.

@ttuegel
ttuegel / haskell-mode-indent.md
Last active February 15, 2016 23:06
Indentation pains in haskell-mode for Emacs

Electric indentation for parentheses, brackets, braces, commas, semicolons...

This isn't an issue of what I want, but rather when I want it. haskell-mode knows how to indent these things correctly, but I had to turn off electric indentation in haskell-mode because it does stupid things the rest of the time.

Concretely, I want a haskell-mode that knows how to be electric when there's only one "right" choice and that doesn't do stupid things when there are multiple possibilities.

Keybase proof

I hereby claim:

  • I am ttuegel on github.
  • I am ttuegel (https://keybase.io/ttuegel) on keybase.
  • I have a public key ASASqOcv7gWaWVi7ZqerjxQEI_mRVcIUpDSWmyvineWJjgo

To claim this, I am signing this object:

@ttuegel
ttuegel / LazyPattern.hs
Created January 4, 2018 21:13
What does lazy pattern matching do?
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ViewPatterns #-}
module LazyPattern where
import Debug.Trace (trace)
data Foo a = Foo a
deriving (Show)
% Or Simplification
== Header
\begin{code}
{-|
Module : Kore.Step.Simplification.Or
Description : Tools for Or pattern simplification.
Copyright : (c) Runtime Verification, 2018
License : NCSA
@ttuegel
ttuegel / Bool.hs
Created February 13, 2019 17:07
Bool.hs
test_binaryTrees :: TestTree
test_binaryTrees =
testGroup "Combinations with operators that produce top or bottom"
[ mkEquals_ internalTrue internalFalse `becomes` bottom
, mkEquals_ internalFalse internalTrue `becomes` bottom
, mkEquals_ internalTrue internalTrue `becomes` (pure internalTrue)
, mkEquals_ internalFalse internalFalse `becomes` (pure internalFalse)
, mkAnd internalTrue internalFalse `becomes` bottom
, mkAnd internalFalse internalTrue `becomes` bottom
@ttuegel
ttuegel / StrictDeriving.hs
Created August 8, 2021 14:56
Unexpected behavior with Strict + DeriveFunctor
{-# LANGUAGE Strict #-}
{-# LANGUAGE DeriveFunctor #-}
module StrictDeriving where
newtype Id1 a = Id1 a
deriving (Functor, Show)
-- >>> fmap (const 2 . const undefined) (Id1 1)
-- Id1 2