This file contains hidden or 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
% select(X,HasXs,OneLessXs) deletes a single X from HasXs | |
select(X, [X|Xs], Xs). | |
select(X, [Y|Ys], [Y|Zs]) <- select(X, Ys, Zs). | |
% insert(X,OneLessXs, HasXs) inserts X into OneLessXs at a non-deterministic position | |
insert(X, Ys, Zs) <- select(X, Zs, Ys). | |
% permutation1(Input, Output) | |
% non-deterministically select the head of the output, permute the remaining input and use as the tail | |
permutation1(Xs, [Z|Zs]) <- select(Z,Xs,Ys), permutation(Ys,Zs). |
This file contains hidden or 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
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }: | |
let | |
inherit (nixpkgs) pkgs; | |
haskellPackages = if compiler == "default" | |
then pkgs.haskellPackages | |
else pkgs.haskell.packages.${compiler}; |
This file contains hidden or 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
module Queue ( | |
empty | |
, isEmpty | |
, peek | |
, remove | |
, add | |
) where | |
data Queue a = Queue [a] [a] [a] | |
deriving (Eq, Show) |
This file contains hidden or 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.Free | |
data ExprF a k = Lit a | Add k k | |
instance Functor (ExprF a) where | |
fmap f (Lit x) = Lit x | |
fmap f (Add x y) = Add (f x) (f y) | |
type Expr a = Free (ExprF a) () |
This file contains hidden or 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.Profunctor | |
import qualified Data.Set as S | |
import Control.Monad.Trans (liftIO) | |
import Control.Monad.Trans.State | |
type MyMonad r = StateT (S.Set Int) IO r | |
runMyMonad :: MyMonad r -> IO r | |
runMyMonad m = evalStateT m S.empty |
This file contains hidden or 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
diff --git a/compiler/typecheck/TcGenDeriv.lhs b/compiler/typecheck/TcGenDeriv.lhs | |
index 77bda82..1347f14 100644 | |
--- a/compiler/typecheck/TcGenDeriv.lhs | |
+++ b/compiler/typecheck/TcGenDeriv.lhs | |
@@ -171,7 +171,7 @@ gen_Eq_binds loc tycon | |
fall_through_eqn | |
| no_tag_match_cons -- All constructors have arguments | |
= case pat_match_cons of | |
- [] -> [] -- No constructors; no fall-though case | |
+ [] -> [([], undefined_Expr)] -- No constructors; no fall-though case |
NewerOlder