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
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
import Data.OpenUnion (Union, liftUnion) | |
import Data.Singletons.Prelude (type (++)) | |
-- * Union's Little helpers | |
type family a \/ b where | |
Union xs \/ Union ys = Union (xs ++ ys) |
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
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE TypeFamilies #-} | |
class ArithOp op where add, mul :: op | |
class LogicalOp op where and :: op | |
class CompareOp op where less, equal :: op |
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
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTSyntax #-} | |
-- * (G)ADT | |
data DTree where | |
Empty :: DTree | |
Node :: String -> DTree -> DTree -> DTree | |
deriving (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
robots.hs:47:36: error: | |
• Couldn't match type ‘[Char]’ | |
with ‘((a1, b1, [Char]) -> t1) -> t1’ | |
Expected type: ((a1, b1, [Char]) -> ((a1, b1, [Char]) -> t1) -> t1) | |
-> ((((a1, b1, [Char]) -> t1) -> t1, b1, | |
((a1, b1, [Char]) -> t1) -> t1) | |
-> ((a1, b1, [Char]) -> t1) -> t1) | |
-> [Char] | |
Actual type: ((((a1, b1, [Char]) -> t1) -> t1, b1, | |
((a1, b1, [Char]) -> t1) -> t1) |
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
#include <list> | |
using std::list; | |
#include <map> | |
using std::map; | |
#include <set> | |
using std::set; | |
#include <utility> | |
using std::pair; | |
#include <rapidcheck.h> |
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
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Meta where | |
import Control.Monad | |
import Language.Haskell.TH | |
type a // b = 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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
import Data.Kind | |
import Data.List |
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
{-# LANGUAGE DisambiguateRecordFields #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module A where | |
import Data.ByteString | |
import Language.C.Inline as C |
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
#!/usr/bin/env stack | |
{- | |
stack --resolver=lts-14.10 | |
script --ghc-options=-Wall --package=megaparsec --package=parser-combinators | |
-} | |
import Control.Monad.Combinators ((<|>), between, some) | |
import Control.Monad.Combinators.Expr (Operator (InfixL), makeExprParser) | |
import Data.Void (Void) | |
import Text.Megaparsec (Parsec, eof, errorBundlePretty, parse) |
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
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DuplicateRecordFields #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE OverloadedLabels #-} | |
import Control.Lens | |
import Data.Generics.Labels | |
import GHC.Generics | |
import Prelude hiding (id) | |
import qualified Prelude |