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 Main where | |
-- see also Shugo's blog | |
-- http://shugo.net/jit/20111129.html#p01 | |
import Control.Applicative | |
import Data.List | |
import System.Environment | |
import System.IO | |
import qualified Text.ParserCombinators.Parsec as PC |
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 Half where | |
-- http://staff.aist.go.jp/reynald.affeldt/tpp2011/garrigue_candy.v | |
open import Data.Nat | |
open import Data.Nat.Properties | |
open import Relation.Binary.Core | |
open import Relation.Binary.PropositionalEquality | |
half : ℕ -> ℕ |
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
infiniteDescent : ∀ {a l} -> (A : Set a) -> (R : Rel A l) -> | |
(P : Pred A l) -> Noether A R -> | |
((x : A) -> P x -> ∃ (λ y -> R y x × P y)) -> | |
(z : A) -> ¬ (P z) | |
infiniteDescent A R P noe f | |
= noe (λ w → ¬ P w) g | |
where g : (x : A) → ((y : A) → R y x → ¬ P y) → ¬ P x | |
g x h px with f x px | |
... | (v , k) = h v (proj₁ k) (proj₂ k) |
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
noether (A::Set)(R::rel A) :: Type | |
= (P::pred A) -> ((x::A) -> ((y::A) -> R y x -> P y) -> P x) -> (x::A) -> P x | |
infiniteDescent (A::Set) | |
(R::rel A) | |
(P::pred A) | |
:: noether A R -> | |
((x::A) -> P x -> exists A (\(x1::A) -> and (R x1 x) (P x1))) -> | |
(x::A) -> not (P x) | |
= \ (h1::noether A R) -> | |
\ (h2::(x::A) -> P x -> exists A (\(x1::A) -> and (R x1 x) (P x1))) -> |
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
foo() { | |
List<List<int>> arr; | |
arr[0] = 0; // no error nor warning | |
arr = 0; // ditto | |
} | |
main() {} | |
// % dart foo.dart | |
// % | |
// % dart --enable_type_chekcs foo.dart |
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 Peano where | |
open import Data.Nat using (ℕ; zero; suc) | |
open import Relation.Binary.Core using (_≢_; refl) | |
{- | |
already defined: | |
data ℕ : Set where | |
zero : ℕ -- axiom 1 | |
suc : (n : ℕ) -> ℕ -- axiom 2 |
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 Nat where | |
data Nat : Set where | |
Z : Nat | |
S : Nat -> Nat | |
data _plus_is_ : Nat -> Nat -> Nat -> Set where | |
P-Zero : (m n : Nat) -> Z plus m is n | |
P-Succ : (l m n : Nat) -> l plus m is n -> (S l) plus m is (S 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
module Main where | |
-- http://www.f13g.com/%A5%D7%A5%ED%A5%B0%A5%E9%A5%DF%A5%F3%A5%B0/Haskell/GLUT/#content_1_7 | |
import System.Random | |
import Graphics.Gloss | |
import Graphics.Gloss.Interface.Simulate | |
data Particle | |
= Particle { position :: Point |
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 Main where | |
-- http://www.f13g.com/%A5%D7%A5%ED%A5%B0%A5%E9%A5%DF%A5%F3%A5%B0/Haskell/GLUT/#content_1_4 | |
import Graphics.Gloss.Interface.Game | |
data State | |
= State { angle :: Float | |
, isPositive :: Bool | |
, picture :: Picture } |
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 Main where | |
-- http://www.f13g.com/%A5%D7%A5%ED%A5%B0%A5%E9%A5%DF%A5%F3%A5%B0/Haskell/GLUT/#content_1_0 | |
import qualified Control.Monad.State as S | |
import Graphics.UI.GLUT | |
type AngleState a = S.StateT GLdouble IO a | |
timeOut :: Timeout |