tilia-0.2.0.0: corpora/vendored/comment/bracket/comment-inside-the-brackets-of-a-name-out.hs
{-# LANGUAGE LambdaCase #-}
module Loom.Warp where
infixl 6 |+|
( -- threads side by side
|+|) ::
Warp -> Warp -> Warp
( -- the wider one wins
|+|)
(Warp a)
(Warp b) = Warp (max a b)
class Tension a where
( -- tighter is greater
>.) ::
a -> a -> Bool
instance Tension Warp where
( -- by thread count
>.)
(Warp a)
(Warp b) = a > b
first :: [Warp] -> Maybe Warp
first = \case
[ -- nothing on the loom
] -> Nothing
w : _ -> Just w
idle :: () -> Warp
idle = \case
( -- nothing to weave
) -> Warp 0
spent :: [Warp] -> [Warp]
spent ws = do
_ <- ws
[ -- no thread left on the spool
]
newtype Warp = Warp Int