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
module Deriving | |
( ApplicativeInstance(..) | |
, MonadInstance(..) | |
) where | |
import Control.Applicative (liftA, liftA2) | |
import Control.Monad (ap, liftM, liftM2) | |
-- | 'Functor' instances derivable via an 'Applicative' instance, for use with @-XDerivingVia@. | |
-- |
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 FunctionalDependencies #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Mendler where | |
class Iter b t | t -> b where | |
iter :: (forall x . (x -> a) -> b x -> a) -> t -> a | |
data ListF a b = Nil | Cons a b | |
instance Iter (ListF a) [a] 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
module Data.FoldableN where | |
import Control.Applicative -- for ZipList | |
import Linear.V1 -- for V1, an identity functor | |
import Linear.V2 -- for V2, data V2 a = V2 a a | |
class Foldable t => FoldableN t where | |
-- | Fold multiple structures into a 'Monoid'. | |
-- | |
-- @ |
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
__attribute__((format_arg(__NSString__, 2))) | |
NSString *ಠ_ಠ_message(const char *severity, const char *format) { | |
return [NSString stringWithFormat:@"%s: %s", severity, format]; | |
} | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wformat-nonliteral" | |
__attribute__((format(printf, 1, 2))) | |
void ಠ_ಠ_warning(const char *format, ...) { | |
va_list ಠ_ಠ; | |
va_start(ಠ_ಠ, format); |
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 DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilyDependencies #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module NNat 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
compile: input file benchmark/Send/Send10.hs | |
*** Checking old interface for Send.Send10 (use -ddump-hi-diffs for more details): | |
*** Parser [Send.Send10]: | |
!!! Parser [Send.Send10]: finished in 0.55 milliseconds, allocated 0.957 megabytes | |
*** Renamer/typechecker [Send.Send10]: | |
!!! Renamer/typechecker [Send.Send10]: finished in 186.13 milliseconds, allocated 77.516 megabytes | |
*** Desugar [Send.Send10]: | |
Result size of Desugar (before optimization) | |
= {terms: 195, types: 4,554, coercions: 6,170, joins: 0/7} | |
Result size of Desugar (after optimization) |
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
⚆︗⨀ | |
⚆‿⨀ | |
⚆␣⨀ | |
⚆˾⨀ | |
⚆⫎⨀ | |
⚆⩌⨀ |
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
Higgledy piggledy | |
parametricity’s | |
quite a nice property | |
functions can use; | |
Enforcing the absence of | |
state or identity | |
up to the type level | |
promotes reuse. |
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
'use babel'; | |
import {Range} from 'atom'; | |
atom.commands.add('atom-text-editor', 'editor:select-outside-brackets', function () { | |
const editor = atom.workspace.getActiveTextEditor(); | |
const initial = editor && editor.getSelectedBufferRange().freeze(); | |
atom.commands.dispatch(editor.element, 'bracket-matcher:select-inside-brackets'); |
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 AllowAmbiguousTypes, DataKinds, DefaultSignatures, DeriveAnyClass, DeriveFunctor, DeriveGeneric, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators #-} | |
module Rollable where | |
import Data.Functor.Foldable | |
import GHC.Generics | |
data Tree = Empty | Node Tree Int Tree | |
deriving (Eq, Generic, Ord, Rollable, Show) | |
depth :: Tree -> Int |