- Algorithm Design with Haskell
- Beginning Haskell: A Project-Based Approach
- Developing Web Apps with Haskell and Yesod
- Functional Design and Architecture
- Get Programming with Haskell
- Haskell Book
- Haskell Cookbook
- Haskell Data Analysis Cookbook
- Haskell Design Patterns
- Haskell from the Very Beginning
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 BlockArguments, ExplicitNamespaces, DerivingStrategies, ViewPatterns | |
, NoFieldSelectors, OverloadedRecordDot, DuplicateRecordFields #-} | |
{-# OPTIONS_GHC -main-is Main.test -Wall #-} | |
module Main ( | |
Queue(push, pop, front, back, size, empty), new, onSome, test) where | |
import GHC.Conc (type STM, newTVar, readTVar, writeTVar, retry) | |
import Numeric.Natural (type Natural) |
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 GeneralizedNewtypeDeriving #-} | |
module Language.HigherRank.Main | |
( Expr(..) | |
, EVar(..) | |
, Type(..) | |
, TVar(..) | |
, TEVar(..) | |
, runInfer | |
) 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
with import <nixpkgs> {}; with builtins; let | |
dfx-env = import (fetchTarball https://github.com/ninegua/ic-nix/releases/latest/download/dfx-env.tar.gz) {}; | |
mops-nix = https://raw.githubusercontent.com/nomeata/ic-certification/3f51849073d19d2ab46aaff3c4985bf8c60196a1; | |
nodeEnv = import (fetchurl "${mops-nix}/mops.nix/node-env.nix") { | |
nodejs = nodejs-14_x; | |
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; | |
inherit pkgs; | |
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; | |
}; | |
mops = (import (fetchurl "${mops-nix}/mops.nix/node-packages.nix") { |
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
#! /usr/bin/env sh | |
#| | |
exec nix-shell --show-trace --pure -Q -p clisp --run "clisp -q -q $0 ${1+"$@"}" | |
exit | |
|# | |
;; Supposed to be O(letters + total-word * log unique-words) time, | |
;; and slightly less then O(unique-words) space. | |
;; For slower but much more memory efficient version | |
;; alphabetical trees could be useful. |
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 GADTs, LambdaCase, PatternSynonyms, QuantifiedConstraints, RoleAnnotations, TypeApplications, StandaloneDeriving, DerivingVia, MultiParamTypeClasses, StandaloneKindSignatures, FlexibleInstances, DataKinds, PolyKinds, TypeFamilies, FlexibleContexts, FunctionalDependencies, ConstraintKinds, AllowAmbiguousTypes, RankNTypes, ScopedTypeVariables #-} | |
import Data.Kind | |
import Data.Coerce (type Coercible) | |
type MyClass :: Type -> Constraint | |
class MyClass t | |
data HtmlT m t |
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
Yan Shkurinskiy, [18/4/22 8:41 AM] | |
foo :: Int -> Int | |
foo x = map fib [0..] !! x | |
where | |
fib 0 = 1 | |
fib 1 = 1 | |
fib n = foo (n-2) + foo (n-1) | |
foo :: Int -> Int | |
foo = (map fib [0..] !!) |
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
#! /usr/bin/env nix-shell | |
#! nix-shell --show-trace --pure -Q -i "runghc --ghc-arg=-main-is --ghc-arg=Solution.main" -p "ghc.withPackages (pkgs: with pkgs; [ either text ])" -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/cf7475d2061ac3ada4b226571a4a1bb91420b578.tar.gz | |
-- You'll need nix to automatically download the dependencies: | |
-- `{ curl https://nixos.org/nix/install | sh ; } && . ~/.nix-profile/etc/profile.d/nix.sh` | |
{-# LANGUAGE OverloadedStrings | |
, PatternSynonyms #-} | |
import Prelude hiding (lookup) |
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
let | |
channel = with builtins; fromJSON | |
(readFile ./lock); | |
in fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs-channels/archive/" + | |
"${channel.rev}.tar.gz"; | |
inherit (channel) sha256; | |
} |
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 static java.lang.System.*; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
// Implementation of a pseudo-GADT in Java, translating the examples from | |
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf | |
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type | |
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it | |
// isomorphic to the targeted 'GADT'. |
NewerOlder