Skip to content

Instantly share code, notes, and snippets.

View kcsongor's full-sized avatar
🤡
':<>:

Csongor Kiss kcsongor

🤡
':<>:
View GitHub Profile
@kcsongor
kcsongor / auto-reload-haskell.el
Last active November 20, 2020 12:32
Automatically reload interactive haskell-mode buffers (Doom emacs)
(add-hook 'interactive-haskell-mode-hook 'haskell-auto-reload-minor-mode)
(defvar haskell-auto-reload-every-n-sec 1
"When non-nil, automatically reloads haskell buffers after Emacs has been idle for N seconds.")
(defvar haskell-reload-timer nil
"Variable used to store the idle timer.")
(define-minor-mode haskell-auto-reload-minor-mode
"Minor mode for automatically reloading interactive haskell buffers."
@kcsongor
kcsongor / presenter.el
Last active May 17, 2021 13:59
presenter.el
(defgroup presenter nil
"Present source code in emacs.")
(defface presenter-slide-marker-face
'((t))
"Highlight slide marker."
:group 'presenter)
(set-face-attribute 'presenter-slide-marker-face nil :height 1.0 :inherit 'font-lock-warning-face)
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
module HList where
-- statically bounded recursion, see the bottom of the file for results
data HList :: [*] -> * where
Nil :: HList '[]
#!/bin/sh
lhs2TeX --newcode $2 > $4
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
module MarkerClass where
import GHC.TypeLits -- for error messages
@kcsongor
kcsongor / CPP.hs
Last active August 18, 2019 17:01
Define /* with CPP
{-# LANGUAGE CPP #-}
-- This defines the (/*) function in the presence of CPP
(//* */*) :: Int -> Int -> Int
(//* */*) = undefined
@kcsongor
kcsongor / hl.vim
Created January 24, 2019 19:29
highlight words
let s:hlcounter = 1
function! Highlight(word)
let id = 110 + s:hlcounter
exe 'hi Group' . id . ' ctermbg=' . (20 + id) . ' ctermfg=0'
silent! call matchdelete(id)
silent! call matchadd('Group' . id, '\<' . a:word . '\>', 100, id)
let s:hlcounter = s:hlcounter + 1
endfunction
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType, GADTs, TypeOperators #-}
module Lib where
import Data.Kind (Type)
data Cat (a :: ()) (b :: ()) where
MkCat :: Cat '() '()
class Category (k :: t -> t -> Type) where
identity :: k a a
@kcsongor
kcsongor / gmap.hs
Created June 5, 2018 19:26
gmap.hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
module Fold where
data Nat = Z | S Nat