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
(* type-level recursion with fold/unfold *) | |
(* $ eff --effects -l rectypes.eff *) | |
(* there's an unique isomorphism between fold and unfold such that: | |
fold :: ...1 Unfix (...2 Fix (func) ...3) ...4 <=> ...1 Fix (func) ...4 :: unfold | |
where func = \fix -> ...2 fix ...3 | |
so, conceptually: |
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, TypeFamilies, DataKinds, PolyKinds, KindSignatures, TypeOperators, RankNTypes, UndecidableInstances, AllowAmbiguousTypes, ExistentialQuantification, StandaloneDeriving, UnicodeSyntax, Arrows, MultiParamTypeClasses, ScopedTypeVariables #-} | |
data Kind = Self | |
| Kind `To` Kind | |
data SingleKind :: Kind -> * where | |
SingleSelf :: SingleKind Self | |
SingleTo :: SingleKind a -> SingleKind b -> SingleKind (a `To` b) | |
instance Show (SingleKind (k :: Kind)) 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
{-# LANGUAGE DataKinds, KindSignatures, TypeOperators, GADTs, TypeFamilies, UndecidableInstances #-} | |
{- about invariants -} | |
data NatPos = One | Succ NatPos | |
data SingleNatPos :: NatPos -> * where | |
SingleOne :: SingleNatPos One | |
SingleSucc :: SingleNatPos natpos -> SingleNatPos (Succ natpos) | |
type family (m :: NatPos) |+| (n :: NatPos) :: NatPos 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
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install gcc-5 g++-5 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 |
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 UnicodeSyntax #-} | |
module Proof where | |
import System.Console.ANSI | |
import Prelude.Unicode | |
import Control.Monad.Unicode | |
{- | |
Calculations and mathematical proofs of circular computations. | |
@author Marcelo Camargo | |
-} |
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
#Creates a named function using the script block. | |
function Add-Function( | |
[string]$name, | |
[Parameter(ValueFromPipeline=$true)] | |
[ScriptBlock]$block) | |
{ | |
New-Item -Path "Function:" -Name "global:$name" -Value $block | |
} |
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
var Y = function(proc) { | |
return (function(x) { | |
return proc(function(y) { return (x(x))(y);}); | |
})(function(x) { | |
return proc(function(y) { return (x(x))(y);}); | |
}); | |
}; | |
var factgen = function(fact) { | |
return function(n) { |
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 android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
int firstVisibleItem, visibleItemCount, totalItemCount; |