This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS -Wall #-} | |
import Control.Monad (when, unless) | |
import Data.Char (toLower) | |
import Data.List (transpose) | |
import System.Random (randomIO) | |
wordsPath :: FilePath | |
wordsPath = "/usr/share/dict/words" | |
addHangImage :: [String] -> [String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE GADTs #-} | |
module KTuple where | |
type family Fst (xs :: (a, b)) :: a where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE TypeFamilies #-} | |
class Indexable a where | |
instance c ~ Char => Indexable (String, Int, c) where | |
instance Indexable ([(String, a)], String, a) where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- my implementation of this: http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf | |
import qualified Data.PSQueue as DQ | |
insertThenDel k p pq = DQ.deleteMin $ DQ.insert k p pq | |
minPriority pq = | |
case DQ.findMin pq of | |
(Just m) -> | |
let mp = DQ.prio m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies #-} | |
class Collection c where | |
type Element c | |
insert :: Element c -> c -> c | |
instance Collection [a] where | |
type Element [a] = a | |
insert = (:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{- To Run: | |
Load in ghci | |
:set -XOverloadedStrings (for convenience) | |
Execute repl expr -} | |
import Control.Applicative | |
import Control.Monad.State.Strict | |
import Data.Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:leyal@leyal-desktop:~/personal/devel/haskell/irc$ hlint rovar.hs | |
rovar.hs:15:1: Error: Redundant do | |
Found: | |
do loadDir "basic_types" >> loadDir "complex" >> | |
loadDir "single_types" | |
Why not: | |
loadDir "basic_types" >> loadDir "complex" >> | |
loadDir "single_types" | |
rovar.hs:18:20: Warning: Redundant brackets |