--- /dev/null
+# This YAML file describes your package. Stack will automatically generate a
+# Cabal file when you run `stack build`. See the hpack website for help with
+# this file: <https://github.com/sol/hpack>.
+
+name: advent05
+synopsis: Advent of Code
+version: '0.0.1'
+
+default-extensions:
+- AllowAmbiguousTypes
+- ApplicativeDo
+- BangPatterns
+- BlockArguments
+- DataKinds
+- DeriveFoldable
+- DeriveFunctor
+- DeriveGeneric
+- DeriveTraversable
+- EmptyCase
+- FlexibleContexts
+- FlexibleInstances
+- FunctionalDependencies
+- GADTs
+- GeneralizedNewtypeDeriving
+- ImplicitParams
+- KindSignatures
+- LambdaCase
+- MonadComprehensions
+- MonoLocalBinds
+- MultiParamTypeClasses
+- MultiWayIf
+- NamedFieldPuns
+- NegativeLiterals
+- NumDecimals
+# - OverloadedLists
+# - OverloadedStrings
+- PartialTypeSignatures
+- PatternGuards
+- PatternSynonyms
+- PolyKinds
+- RankNTypes
+- RecordWildCards
+- ScopedTypeVariables
+- TemplateHaskell
+- TransformListComp
+- TupleSections
+- TypeApplications
+- TypeFamilies
+- TypeInType
+- TypeOperators
+- ViewPatterns
+
+executables:
+ advent05:
+ main: advent05.hs
+ source-dirs: src
+ dependencies:
+ - base >= 2 && < 6
+ - text
+ - megaparsec
+ - containers
\ No newline at end of file
--- /dev/null
+-- import Debug.Trace
+
+import Numeric
+import qualified Data.Set as S
+
+main :: IO ()
+main =
+ do text <- readFile "data/advent05.txt"
+ let passes = lines text
+ print $ part1 passes
+ print $ part2 passes
+
+part1 = maximum . map convert
+
+part2 passes = S.elemAt 0 $ expecteds `S.difference` knowns
+ where ns = map convert passes
+ highest = maximum ns
+ lowest = minimum ns
+ knowns = S.fromList ns
+ expecteds = S.fromList [lowest..highest]
+
+directionToInt :: Char -> Int
+directionToInt dir = if dir `elem` "BR" then 1 else 0
+
+convert :: String -> Int
+convert = fst . head . readInt 2 (`elem` "FBLR") directionToInt