Skip to content

Instantly share code, notes, and snippets.

@23Skidoo
23Skidoo / FloydWarshall.hs
Created October 17, 2012 04:24
Floyd-Warshall algorithm in Haskell
module Floyd
where
import Control.Applicative ( (<$>) )
import Control.Exception ( assert )
import Control.Monad ( forM_, when )
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.ST
import Data.Maybe ( fromMaybe )
@queertypes
queertypes / FreeCoFree.hs
Created June 5, 2015 17:11
Exploring Free Monads, Cofree Comonads, and Pairings: DSLs and Interpreters
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-
Explores Free Monads (DSLs) and Cofree Comonads (interpreters) and
their relationship.
Most of the code in this file comes from (1) below. Only minor
modifications are made - semantics are preserved.

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@gallais
gallais / TicTacToe.hs
Created February 20, 2016 15:33
A simple game of Tic-Tac-Toe using Haskell's gloss
import Data.Maybe
import Control.Monad
import Control.Applicative
import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game
type Coordinates = (Int, Int)
data Player = Nought | Cross
@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active November 13, 2024 04:06
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@dino-
dino- / string-conversions.hs
Last active November 10, 2024 23:45
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@andygeorge
andygeorge / steamdeck_ssh_instructions.md
Last active February 21, 2024 06:54
Steam Deck `ssh` instructions

These are manual instructions on enabling SSH access on your Steam Deck, adding public key authentication, and removing the need for a sudo password for the main user (deck).

This gist assumes the following:

  • you have a Steam Deck
  • you have a home PC with access to a Linux shell that can ssh, ssh-keygen, and ssh-copy-id
  • your Steam Deck and home PC are on the same local network, with standard SSH traffic (tcp/22) allowed over that network from the PC to the Steam Deck

NOTE: @crackelf on reddit mentions that steamOS updates blow away everything other than /home, which may have the following effects:

  • removing the systemd config for sshd.service, which would prevent the service from automatically starting on boot
  • removing the sudoers.d config, which would reenable passwords for sudo
@jameshaydon
jameshaydon / whynothaskell.md
Last active September 29, 2023 15:52
Why (some) Python programmers don't choose Haskell

Why Python and not Haskell?

This thread asks why more Python developers couldn't instead be using Haskell: https://discourse.haskell.org/t/commercial-haskell-should-go-after-python-julia-not-rust/6964/2

One of the points made in this thread, is that there is a sizeable class of Python programmers for which the trope "Python programmers will be scared of monads!" doesn't apply. I thought I would ask some of the people I know that use Python why they don't use Haskell.

Some notes about the demographic:

  • These people all work as academic researchers in Computer Science, formal methods, ranging from very abstract to quite practical.
  • Two of them know more about Category Theory and monads than the vast majority of Haskellers.