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
module Crush( | |
AST(..) | |
, crush | |
, crushMap | |
, crushMapM | |
-- debugging | |
, buildAst | |
, printAst | |
) where |
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
module PCP where | |
import Data.List | |
import Data.Tree | |
-- breadth-first traversal | |
levelf :: Forest a -> [[a]] | |
levelf = unfoldr f | |
where f [] = Nothing | |
f xs = Just (map rootLabel xs, concat $ map subForest xs) |
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 DeriveFunctor, TypeFamilies #-} | |
module Main where | |
data Pair a = Pair a a | |
deriving (Eq) | |
getFst :: Pair a -> a | |
getFst (Pair x1 _) = x1 |
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 DeriveFunctor, TypeFamilies #-} | |
module Main where | |
data Pair a = Pair a a | |
deriving (Eq) | |
getFst :: Pair a -> a | |
getFst (Pair x1 _) = x1 |
NewerOlder