table mail {
id int primary key,
from_addr varchar[50],
date datetime,
mailbox varchar[50]
}
| module TypeChecker where | |
| type Vname = String | |
| data Vexp = Var Vname | |
| | Lambda Vname Vexp | |
| | Ap Vexp Vexp | |
| | Let [Vname] [Vexp] Vexp | |
| | Letrec [Vname] [Vexp] Vexp |
| {-# LANGUAGE OverloadedStrings #-} | |
| import Data.ByteString (ByteString) | |
| import qualified Data.ByteString as B | |
| import Data.ByteString.Char8 () | |
| import Data.Text (Text) | |
| import qualified Data.Text as T | |
| foo :: String -> Int |
| {-# OPTIONS_GHC -fno-warn-missing-signatures #-} | |
| module Spec (main) where | |
| import Test.HUnit | |
| import System.Process | |
| import System.IO | |
| subprocess = concat $ | |
| [ "module Main where\n" | |
| , "import System.IO\n" | |
| , "main = do\n" |
| -- ghc Main.hs -package ghc | |
| module Main where | |
| import DynFlags | |
| import FastString | |
| import HsSyn | |
| import Lexer | |
| import Outputable | |
| import Parser |
| PFDS: Ex 3.1 | |
| 定理: | |
| Leftistヒープ T において、右のパスの長さが k である場合、 | |
| T のノード数 n は | |
| n >= 2^(k+1) - 1 | |
| である。 | |
| 証明:T の高さである h について帰納法で証明する。 |
| module Merge where | |
| merge :: (Ord a) => [a] -> [a] -> [a] | |
| merge xs [] = xs | |
| merge [] ys = ys | |
| merge l@(x:xs) r@(y:ys) | |
| | x < y = x: merge xs r | |
| | otherwise = y: merge l ys | |
| msort :: Ord a => [a] -> [a] |
| import Data.Map | |
| import Prelude hiding (lookup) | |
| primes :: [Integer] | |
| primes = sieve [2..] | |
| sieve :: [Integer] -> [Integer] | |
| sieve xs = sieve' xs empty | |
| sieve' :: [Integer] -> Map Integer [Integer] -> [Integer] |