Skip to content

Instantly share code, notes, and snippets.

@aplainzetakind
Created November 26, 2020 08:13
Show Gist options
  • Save aplainzetakind/ba5b0fa3af4ef7f3deec77c5e025b746 to your computer and use it in GitHub Desktop.
Save aplainzetakind/ba5b0fa3af4ef7f3deec77c5e025b746 to your computer and use it in GitHub Desktop.
{-# LANGUAGE CPP #-}
module Advent (advent, Stars(..)) where
import Advent.Utils (Stars(..), Result)
#ifdef Y2015
import qualified Advent.Y2015 as Y2015
#endif
#ifdef Y2016
import qualified Advent.Y2016 as Y2016
#endif
#ifdef Y2017
import qualified Advent.Y2017 as Y2017
#endif
#ifdef Y2018
import qualified Advent.Y2018 as Y2018
#endif
#ifdef Y2019
import qualified Advent.Y2019 as Y2019
#endif
#ifdef Y2020
import qualified Advent.Y2020 as Y2020
#endif
advent :: Int -> Int -> Stars -> String -> Result
advent = \case
#ifdef Y2015
2015 -> Y2015.advent
#endif
#ifdef Y2016
2016 -> Y2016.advent
#endif
#ifdef Y2017
2017 -> Y2017.advent
#endif
#ifdef Y2018
2018 -> Y2018.advent
#endif
#ifdef Y2019
2019 -> Y2019.advent
#endif
#ifdef Y2020
2020 -> Y2020.advent
#endif
y -> error $ "Not compiled with " ++ show y ++ "."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment