diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-07-01 17:50:08 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-07-01 17:50:08 +0200 |
commit | 77996d3f4b4f143bb2406566d103640de1a7e727 (patch) | |
tree | cac9b69d5cb8c95940fa95e11e2257a48bf5ba88 | |
parent | Add astro dependency (diff) | |
download | sky-info-77996d3f4b4f143bb2406566d103640de1a7e727.tar.gz sky-info-77996d3f4b4f143bb2406566d103640de1a7e727.tar.bz2 sky-info-77996d3f4b4f143bb2406566d103640de1a7e727.zip |
Add skeleton functionality
-rw-r--r-- | app/Main.hs | 4 | ||||
-rw-r--r-- | sky-info.cabal | 1 | ||||
-rw-r--r-- | src/Lib.hs | 17 | ||||
-rw-r--r-- | src/Logic.hs | 32 |
4 files changed, 49 insertions, 5 deletions
diff --git a/app/Main.hs b/app/Main.hs index de1c1ab..2f41140 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,6 +1,6 @@ module Main where -import Lib +import Lib (sky_info_main) main :: IO () -main = someFunc +main = sky_info_main \ No newline at end of file diff --git a/sky-info.cabal b/sky-info.cabal index 2bc48cc..e26842d 100644 --- a/sky-info.cabal +++ b/sky-info.cabal @@ -26,6 +26,7 @@ source-repository head library exposed-modules: Lib + Logic other-modules: Paths_sky_info hs-source-dirs: diff --git a/src/Lib.hs b/src/Lib.hs index d36ff27..f594506 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -1,6 +1,17 @@ module Lib - ( someFunc + ( sky_info_main ) where -someFunc :: IO () -someFunc = putStrLn "someFunc" + +import Data.Astro.Types +import Data.Astro.Time.JulianDate + +import Logic + +sky_info_main :: IO () +sky_info_main = do + date <- return $ fromYMDHMS 2022 6 25 9 29 0 + location <- return $ GeoC (DD 4.23) (DD 8.17) + sky <- return $ generateSky date + relative_sky <- return $ relativize_sky sky location + putStrLn $ show relative_sky \ No newline at end of file diff --git a/src/Logic.hs b/src/Logic.hs new file mode 100644 index 0000000..fb2a03b --- /dev/null +++ b/src/Logic.hs @@ -0,0 +1,32 @@ +module Logic where + +import Data.Astro.Types +import Data.Astro.Time.JulianDate +import Data.Astro.Coordinate + +data SkyT = Sky { date :: JulianDate, + nonVisibleObjects :: [SkyObjectT], + visibleObjects :: [SkyObjectT] + } deriving (Show) + +data SkyObjectT = SkyObject { + name :: String + --coordinates :: EquatorialCoordinates1 + --m_relative_coordinates :: Maybe HorizonCoordinates +} deriving (Show) + +generateSky :: JulianDate -> SkyT +generateSky date = let + (nonVisibleObjects, visibleObjects) = predictSkyObjects date + in + Sky { + date = date, + nonVisibleObjects=nonVisibleObjects, + visibleObjects=visibleObjects + } + +predictSkyObjects :: JulianDate -> ([SkyObjectT], [SkyObjectT]) +predictSkyObjects date = ([SkyObject { name="test" }], [SkyObject { name= "uwu" }]) + +relativize_sky :: SkyT -> GeographicCoordinates -> SkyT +relativize_sky sky location = sky \ No newline at end of file |