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 qualified Control.Monad.WeightedSearch as W | |
import Data.List (sortBy) | |
import Data.Ord (comparing) | |
import Control.Applicative | |
data BTree = Leaf | Branch BTree BTree deriving (Show, Eq) | |
-- I can lazily list all the btrees | |
btrees :: W.T Integer BTree | |
btrees = pure Leaf <|> W.weight 1 (Branch <$> btrees <*> btrees) |