Inline some functions and simplify
This commit is contained in:
parent
8e6179f103
commit
c4b85eac71
@ -3,7 +3,6 @@ module Main (main) where
|
||||
import Pre
|
||||
|
||||
import Data.Functor.Contravariant
|
||||
import Data.Functor.Identity
|
||||
import Data.Text.IO qualified as T
|
||||
import Puzzles.Day1 qualified as Day1
|
||||
import Puzzles.Day10 qualified as Day10
|
||||
@ -42,7 +41,7 @@ main =
|
||||
describe pt do
|
||||
input <- liftIO $ parseFile $ "../inputs/" <> t <> "/" <> pt
|
||||
let (rs, os) =
|
||||
((unHListF . mapHListF (Const . fst)) &&& (fromHListF . mapHListF (Identity . snd))) $
|
||||
((getConst . foldHListF (\x r -> Const $ fst x : getConst r) (Const [])) &&& foldHListF (HCons . snd) HNil) $
|
||||
mapHListF (\(Fanout (f, Op o)) -> (o &&& id) $ f input) parts
|
||||
for_ (zip [1 :: Int ..] rs) $ uncurry $ \(show -> n) ->
|
||||
it n . pureGoldenTextFile ("../outputs/" <> t <> "/" <> pt <> "/" <> n) . (<> "\n")
|
||||
|
||||
@ -44,8 +44,6 @@ module Pre (
|
||||
HListF (..),
|
||||
foldHListF,
|
||||
mapHListF,
|
||||
fromHListF,
|
||||
unHListF,
|
||||
(/\),
|
||||
(/\\),
|
||||
nil,
|
||||
@ -78,7 +76,6 @@ import Data.Foldable1
|
||||
import Data.Function
|
||||
import Data.Functor
|
||||
import Data.Functor.Contravariant
|
||||
import Data.Functor.Identity
|
||||
import Data.Kind (Type)
|
||||
import Data.List (List, sortOn, transpose)
|
||||
import Data.List.Extra (dropEnd, enumerate, firstJust, notNull, splitOn)
|
||||
@ -158,12 +155,6 @@ foldHListF f e = \case
|
||||
mapHListF :: (forall a. f a -> g a) -> HListF f as -> HListF g as
|
||||
mapHListF t = foldHListF (\x r -> HConsF (t x) $ r) HNilF
|
||||
|
||||
fromHListF :: HListF Identity as -> HList as
|
||||
fromHListF = foldHListF (\(Identity x) r -> HCons x r) HNil
|
||||
|
||||
unHListF :: HListF (Const b) as -> List b
|
||||
unHListF = getConst . foldHListF (\(Const x) (Const r) -> Const $ x : r) (Const [])
|
||||
|
||||
instance Semigroup (TestDefM a b ()) where
|
||||
(<>) = (>>)
|
||||
instance Monoid (TestDefM a b ()) where
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user