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
| zipRev :: [a] -> [b] -> [(a,b)] | |
| zipRev xs ys = fr where | |
| (fr, allbs) = go [] allbs xs ys | |
| go acc ~(b':bs') (a:as) (b:bs) = ((a,b') : res, bss) | |
| where | |
| (res, bss) = go (b:acc) bs' as bs | |
| go acc _ _ _ = ([], acc) |
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
| -- | This module defines a function that produces a complete binary tree | |
| -- from a breadth-first list of its (internal) node labels. It is an | |
| -- optimized version of an implementation by Will Ness that avoids | |
| -- any "impossible" cases. See | |
| -- | |
| -- https://stackoverflow.com/a/60561480/1477667 | |
| module Bftr (Tree (..), bft, list, deftest) where | |
| import Data.Function (fix) | |
| import Data.Monoid (Endo (..)) |
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 GADTs, ScopedTypeVariables, DeriveTraversable #-} | |
| module ChallengeTransform where | |
| import Data.Typeable | |
| import Data.Proxy | |
| import Data.Coerce | |
| data Scheme a where | |
| Res :: Typeable a => !(Proxy a) -> Scheme a | |
| Arg :: Typeable a => !(Proxy a) -> Scheme b -> Scheme (a -> b) |
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 EmptyCase #-} | |
| {-# language FlexibleContexts #-} | |
| {-# language FlexibleInstances #-} | |
| {-# language InstanceSigs #-} | |
| {-# language MultiParamTypeClasses #-} | |
| {-# language PolyKinds #-} | |
| {-# language QuantifiedConstraints #-} | |
| {-# language ScopedTypeVariables #-} | |
| {-# language StandaloneKindSignatures #-} | |
| {-# language TypeApplications #-} |
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 BangPatterns #-} | |
| {-# language LinearTypes #-} | |
| {-# language GADTs #-} | |
| {-# language StandaloneKindSignatures #-} | |
| {-# language KindSignatures #-} | |
| {-# language TypeApplications #-} | |
| {-# language DataKinds #-} | |
| {-# language ScopedTypeVariables #-} | |
| -- | Pairing heap loosely based on one Donnacha Oisín Kidney wrote for |
OlderNewer