Skip to content

Instantly share code, notes, and snippets.

View DKurilo's full-sized avatar
🔬
∀ f. Functor f ⇒ (a → f b) → s → f t

Dima DKurilo

🔬
∀ f. Functor f ⇒ (a → f b) → s → f t
View GitHub Profile
module Main where
import Data.Char
import Data.ByteString.Char8 hiding (all, putStrLn)
import System.IO
getStr _ 0 _ = return ""
getStr h n p = do
c <- unpack <$> hGet h 1
if all p c
@DKurilo
DKurilo / fun-with-functional-dependencies.hs
Last active June 26, 2019 18:06
Haskell allow to use Functional dependencies. Using FD one can do Prolog-like things with types and classes. In compile time. Further: http://www.cse.chalmers.se/~hallgren/Papers/hallgren.pdf
{-# LANGUAGE FlexibleInstances, FunctionalDependencies, UndecidableInstances #-}
-- Esoteric programming with Haskell:
-- http://www.cse.chalmers.se/~hallgren/Papers/hallgren.pdf
-- https://repl.it/repls/AquaGainsboroSquares
module Fun where
data True
data False
@DKurilo
DKurilo / functional-dependency-fib.hs
Last active June 26, 2019 18:05
Fibonacci in compile time
{-# LANGUAGE FlexibleInstances, FunctionalDependencies, UndecidableInstances #-}
-- Esoteric programming with Haskell:
-- http://www.cse.chalmers.se/~hallgren/Papers/hallgren.pdf
-- https://repl.it/repls/AquaGainsboroSquares
module Main where
import System.IO
u = undefined