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
{-@ LIQUID "--reflection" @-} | |
{-@ LIQUID "--ple" @-} | |
import Language.Haskell.Liquid.ProofCombinators | |
import Prelude hiding (flip, foldl, foldr, reverse, (++)) | |
{-@ reflect foldr @-} | |
foldr :: (a -> b -> b) -> b -> [a] -> b | |
foldr f a [] = a |
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
-- {-@ LIQUID "--reflection" @-} | |
{-@ LIQUID "--ple" @-} | |
import qualified Data.Set as Set | |
import Data.Set (Set) | |
-- makeLeafSet = Set.fromList . map (uncurry Leaf) | |
data Bit = B0 | B1 deriving (Eq,Ord) |
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 EmptyCase #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# OPTIONS -fwarn-incomplete-patterns #-} | |
import Prelude hiding (Bool(..)) | |
aa :: a -> a | |
aa a = a | |
aba :: a -> b -> a |
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
allMerges :: [a] -> [a] -> [[a]] | |
allMerges [] ys = [ys] | |
allMerges xs [] = [xs] | |
allMerges left@(x:xs) right@(y:ys) = | |
map (x:) (allMerges xs right) ++ map (y:) (allMerges left ys) | |
-- > f [1,2,3] [11,12,13] | |
-- [ [1,2,3,11,12,13], | |
-- [1,2,11,3,12,13], |
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
Haskell: | |
https://www.codewars.com/kata/5512ec4bbe2074421d00028c | |
https://www.codewars.com/kata/547202bdf7587835d9000c46 | |
https://www.codewars.com/kata/543d218022e0f307fb000173 | |
noen litt mindre hasklete som kanskje er | |
fine i Haskell |
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
function compare() { | |
baseurl="https://github.com/" | |
remote=$(git remote get-url origin) | |
tempRepo=${${remote}#"git@github.com:"} | |
repo=${${tempRepo}%".git"} | |
branchname=$(git rev-parse --abbrev-ref HEAD) | |
url=$baseurl$repo"/compare/"$branchname | |
eval "open -a 'Google Chrome' $url" | |
} |
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 QuasiQuotes #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Aeson.QQ | |
import Data.Aeson | |
import Data.Aeson.Lens | |
import Control.Lens | |
obj = [aesonQQ| | |
{ |
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
;;state :: s -> (a s) | |
(define (map-state f st) | |
(lambda (x) | |
(let* ((res (st x)) | |
(a (car res)) | |
(s (cadr res))) | |
(state (f a) s)))) |
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.Monad ((<=<)) | |
import Data.Maybe (catMaybes, listToMaybe) | |
import Safe | |
xss = [ | |
[1,2,3], | |
[4,5,6], | |
[7,8,9] | |
] |
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 RebindableSyntax #-} | |
import Prelude hiding ( (>>=),(>>) ) | |
import qualified Prelude as P | |
import Liquid.Haskell.ProofCombinators | |
{-@ (>>) :: x:a -> y:{a | y == x} -> {v:a | v == x && v == y} @-} | |
(>>) x y = x === y |
NewerOlder