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
import Control.Applicative | |
import qualified Data.Map as Map | |
import Debug.Trace | |
import Data.Foldable | |
import Data.Maybe | |
import Data.Ord | |
import Data.List | |
import Data.List.NonEmpty (nonEmpty) | |
minTransitions :: |
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
Require Import Coq.Lists.List. | |
Import Coq.Lists.List.ListNotations | |
Fixpoint my_remove_last {A : Type} (l : list A) : list A:= | |
match l with | |
| [] => [] | |
| x :: [] => [] | |
| x :: xs => x :: (my_remove_last xs) | |
end. |
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, DeriveFunctor #-} | |
import Data.Functor.Foldable | |
data Tree a = Leaf | Node a (Tree a) (Tree a) deriving (Show) | |
data TreeF a b = LeafF | NodeF a b b deriving (Functor, Show) | |
type instance Base (Tree a) = TreeF a | |
instance Recursive (Tree a) where | |
project Leaf = LeafF |
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
### Keybase proof | |
I hereby claim: | |
* I am bruno-cadorette on github. | |
* I am brunocadorette (https://keybase.io/brunocadorette) on keybase. | |
* I have a public key ASDpLETUCCZ5yGWHBeGCTPt9d-RKxIOW9NeZIYe1nvICNgo | |
To claim this, I am signing this object: |
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
/* | |
GNU GENERAL PUBLIC LICENSE | |
Version 3, 29 June 2007 | |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
Everyone is permitted to copy and distribute verbatim copies | |
of this license document, but changing it is not allowed. | |
Preamble |
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
using System; | |
namespace MaybeCSharp | |
{ | |
interface IMaybe<T> | |
{ | |
IMaybe<U> Bind<U>(Func<T, IMaybe<U>> f); | |
IMaybe<U> Map<U>(Func<T, U> f); | |
IMaybe<U> Ap<U>(IMaybe<Func<T, U>> f); | |
} |
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
import Keyboard | |
import Mouse exposing (position) | |
import Time exposing (Time, fps) | |
import Debug exposing(..) | |
import Signal | |
import Graphics.Element exposing (show) | |
import Graphics.Collage | |
import Color exposing (red, black) | |
import Window exposing (dimensions) |
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
import Data.List | |
import Data.Tree | |
import Control.Arrow (first) | |
import Data.Function (on) | |
toHierarchical :: String -> [(Int, [String])] | |
toHierarchical = map simplify . groupBy ((==) `on` fst) . map (first length . span (== '\t')) . lines | |
where | |
simplify = first head . unzip | |
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
using System; | |
namespace CSharpFunctional | |
{ | |
[Serializable] | |
public class NoPatternException : Exception | |
{ | |
public NoPatternException() { } | |
public NoPatternException(string message) : base(message) { } | |
public NoPatternException(string message, Exception inner) : base(message, inner) { } |
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
import Text.Read (readMaybe) | |
import System.Random (randomRIO) | |
data Move = Rock | Paper | Scissor deriving(Eq, Read, Show, Enum) | |
data Result = Victory | Defeat | Draw deriving(Show) | |
play Rock Scissor = Victory | |
play Paper Rock = Victory | |
play Scissor Paper = Victory | |
play a b |
NewerOlder