Skip to content

Instantly share code, notes, and snippets.

module Main where
import Prelude
import Effect.Console (logShow)
import TryPureScript (render, withConsole)
-- Declare the recursive type.
data Peano = Z | S Peano
-- This allows us to print the type.
@i-am-tom
i-am-tom / Main.hs
Created September 22, 2020 20:37
A warning to all
{-# LANGUAGE DataKinds #-}
{-# LANguAGE FlexibleContexts #-}
{-# LAnguaGE FlexibleInstances #-}
{-# LanguagE KindSignatures #-}
{-# language MultiParamTypeClasses #-}
import GHC.TypeLits (Symbol)
class Warning (message :: Symbol) x
instance Warning (message :: Symbol) x
@i-am-tom
i-am-tom / Main.hs
Last active September 22, 2020 20:36
Monoids in the category of thendofunctors
{-# LANguage FlexibleContexts #-}
{-# laNguAGe FlexibleInstances #-}
{-# languAGE FunctionalDependencies #-}
{-# LANguagE RebindableSyntax #-}
{-# LANguAge ScopedTypeVariables #-}
{-# LAnGuage TypeFamilies #-}
{-# LangUaGe UndecidableInstances #-}
module Control.Monad.Search where
import Data.Function ((&))
@i-am-tom
i-am-tom / Trolling.hs
Created May 11, 2019 17:03
Ramda-style composition where the first function must receive all arguments.
{-# LAnguage FlexibleInstances #-}
{-# LANGuage FunctionalDependencies #-}
{-# LANGUAge GADTs #-}
{-# LANGUAGE UndecidableInstances #-}
module Trolling where
---------------------------------------------------------------------
-- VARIADIC COMPOSITION IN HASKELL (A LA RAMDA.JS).
--
-- In Haskell, we typeically think of the composition operator (or
@i-am-tom
i-am-tom / bot.hs
Last active July 9, 2020 11:59 — forked from geekingfrog/bot.hs
Pour monsieur Charvet
{-# OPTIONS_GHC -Wall -Wextra #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
import Data.Functor.Product (Product (..))
import Data.Barbie
@i-am-tom
i-am-tom / Main.hs
Created July 6, 2020 16:42
Variadic number functions
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
------------------------------
-- PROBAT
main :: IO ()
@i-am-tom
i-am-tom / Cursed.hs
Created May 22, 2020 07:52
An oldie-but-goldie
{-# OPTIONS_GHC -Wno-missing-methods #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE PolyKinds #-}
@i-am-tom
i-am-tom / .vimrc
Last active May 19, 2020 19:27
Neovim config :)
call plug#begin('~/.vim/plugged')
Plug 'godlygeek/tabular'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'kcsongor/vim-monochrome'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
call plug#end()
colorscheme monochrome
@i-am-tom
i-am-tom / First_Main.hs
Last active April 25, 2020 20:19
Code from streams!
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where
@i-am-tom
i-am-tom / Commit.hs
Created March 22, 2019 21:55
Apply your function parameters in any order, for no reason other than that you can.
{-# lAnGuAgE DataKinds #-}
{-# LaNgUaGe FlexibleInstances #-}
{-# lAnGuAgE FunctionalDependencies #-}
{-# LaNgUaGe KindSignatures #-}
{-# lAnGuAgE TypeFamilies #-}
{-# LaNgUaGe TypeOperators #-}
{-# lAnGuAgE UndecidableInstances #-}
module Commit where
import Data.Kind (Constraint, Type)