Robot Haskell

This commit is contained in:
Rafał Sobański 2021-04-06 16:38:26 +02:00
commit b3523fc2ad
38 changed files with 1150 additions and 0 deletions

View File

@ -0,0 +1,50 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -fno-warn-implicit-prelude #-}
module Paths_shadow_library (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
#if defined(VERSION_base)
#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif
#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch
version :: Version
version = Version [0,1,0,0] []
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/bin"
libdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC"
dynlibdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2"
datadir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/share/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0"
libexecdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/libexec/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0"
sysconfdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/etc"
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
getBinDir = catchIO (getEnv "shadow_library_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "shadow_library_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "shadow_library_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "shadow_library_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "shadow_library_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "shadow_library_sysconfdir") (\_ -> return sysconfdir)
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir ++ "/" ++ name)

View File

@ -0,0 +1,297 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package shadow-library-0.1.0.0 */
#ifndef VERSION_shadow_library
#define VERSION_shadow_library "0.1.0.0"
#endif /* VERSION_shadow_library */
#ifndef MIN_VERSION_shadow_library
#define MIN_VERSION_shadow_library(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_shadow_library */
/* package base-4.10.1.0 */
#ifndef VERSION_base
#define VERSION_base "4.10.1.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 10 || \
(major1) == 4 && (major2) == 10 && (minor) <= 1)
#endif /* MIN_VERSION_base */
/* package HTTP-4000.3.11 */
#ifndef VERSION_HTTP
#define VERSION_HTTP "4000.3.11"
#endif /* VERSION_HTTP */
#ifndef MIN_VERSION_HTTP
#define MIN_VERSION_HTTP(major1,major2,minor) (\
(major1) < 4000 || \
(major1) == 4000 && (major2) < 3 || \
(major1) == 4000 && (major2) == 3 && (minor) <= 11)
#endif /* MIN_VERSION_HTTP */
/* package hxt-9.3.1.16 */
#ifndef VERSION_hxt
#define VERSION_hxt "9.3.1.16"
#endif /* VERSION_hxt */
#ifndef MIN_VERSION_hxt
#define MIN_VERSION_hxt(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 3 || \
(major1) == 9 && (major2) == 3 && (minor) <= 1)
#endif /* MIN_VERSION_hxt */
/* package hxt-http-9.1.5.2 */
#ifndef VERSION_hxt_http
#define VERSION_hxt_http "9.1.5.2"
#endif /* VERSION_hxt_http */
#ifndef MIN_VERSION_hxt_http
#define MIN_VERSION_hxt_http(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 1 || \
(major1) == 9 && (major2) == 1 && (minor) <= 5)
#endif /* MIN_VERSION_hxt_http */
/* package hxt-xpath-9.1.2.2 */
#ifndef VERSION_hxt_xpath
#define VERSION_hxt_xpath "9.1.2.2"
#endif /* VERSION_hxt_xpath */
#ifndef MIN_VERSION_hxt_xpath
#define MIN_VERSION_hxt_xpath(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 1 || \
(major1) == 9 && (major2) == 1 && (minor) <= 2)
#endif /* MIN_VERSION_hxt_xpath */
/* package MissingH-1.4.0.1 */
#ifndef VERSION_MissingH
#define VERSION_MissingH "1.4.0.1"
#endif /* VERSION_MissingH */
#ifndef MIN_VERSION_MissingH
#define MIN_VERSION_MissingH(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 4 || \
(major1) == 1 && (major2) == 4 && (minor) <= 0)
#endif /* MIN_VERSION_MissingH */
/* package monad-logger-0.3.28.5 */
#ifndef VERSION_monad_logger
#define VERSION_monad_logger "0.3.28.5"
#endif /* VERSION_monad_logger */
#ifndef MIN_VERSION_monad_logger
#define MIN_VERSION_monad_logger(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 3 || \
(major1) == 0 && (major2) == 3 && (minor) <= 28)
#endif /* MIN_VERSION_monad_logger */
/* package mtl-2.2.2 */
#ifndef VERSION_mtl
#define VERSION_mtl "2.2.2"
#endif /* VERSION_mtl */
#ifndef MIN_VERSION_mtl
#define MIN_VERSION_mtl(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 2 || \
(major1) == 2 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_VERSION_mtl */
/* package network-uri-2.6.1.0 */
#ifndef VERSION_network_uri
#define VERSION_network_uri "2.6.1.0"
#endif /* VERSION_network_uri */
#ifndef MIN_VERSION_network_uri
#define MIN_VERSION_network_uri(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 6 || \
(major1) == 2 && (major2) == 6 && (minor) <= 1)
#endif /* MIN_VERSION_network_uri */
/* package regex-pcre-0.94.4 */
#ifndef VERSION_regex_pcre
#define VERSION_regex_pcre "0.94.4"
#endif /* VERSION_regex_pcre */
#ifndef MIN_VERSION_regex_pcre
#define MIN_VERSION_regex_pcre(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 94 || \
(major1) == 0 && (major2) == 94 && (minor) <= 4)
#endif /* MIN_VERSION_regex_pcre */
/* package regex-tdfa-1.2.3 */
#ifndef VERSION_regex_tdfa
#define VERSION_regex_tdfa "1.2.3"
#endif /* VERSION_regex_tdfa */
#ifndef MIN_VERSION_regex_tdfa
#define MIN_VERSION_regex_tdfa(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 2 || \
(major1) == 1 && (major2) == 2 && (minor) <= 3)
#endif /* MIN_VERSION_regex_tdfa */
/* package resourcet-1.2.1 */
#ifndef VERSION_resourcet
#define VERSION_resourcet "1.2.1"
#endif /* VERSION_resourcet */
#ifndef MIN_VERSION_resourcet
#define MIN_VERSION_resourcet(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 2 || \
(major1) == 1 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_VERSION_resourcet */
/* package text-1.2.3.0 */
#ifndef VERSION_text
#define VERSION_text "1.2.3.0"
#endif /* VERSION_text */
#ifndef MIN_VERSION_text
#define MIN_VERSION_text(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 2 || \
(major1) == 1 && (major2) == 2 && (minor) <= 3)
#endif /* MIN_VERSION_text */
/* package time-1.8.0.2 */
#ifndef VERSION_time
#define VERSION_time "1.8.0.2"
#endif /* VERSION_time */
#ifndef MIN_VERSION_time
#define MIN_VERSION_time(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 8 || \
(major1) == 1 && (major2) == 8 && (minor) <= 0)
#endif /* MIN_VERSION_time */
/* package transformers-0.5.2.0 */
#ifndef VERSION_transformers
#define VERSION_transformers "0.5.2.0"
#endif /* VERSION_transformers */
#ifndef MIN_VERSION_transformers
#define MIN_VERSION_transformers(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 5 || \
(major1) == 0 && (major2) == 5 && (minor) <= 2)
#endif /* MIN_VERSION_transformers */
/* package tz-0.1.3.1 */
#ifndef VERSION_tz
#define VERSION_tz "0.1.3.1"
#endif /* VERSION_tz */
#ifndef MIN_VERSION_tz
#define MIN_VERSION_tz(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 3)
#endif /* MIN_VERSION_tz */
/* tool gcc-10.2.0 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "10.2.0"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 10 || \
(major1) == 10 && (major2) < 2 || \
(major1) == 10 && (major2) == 2 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-8.2.2 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "8.2.2"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 2 || \
(major1) == 8 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-8.2.2 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "8.2.2"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 2 || \
(major1) == 8 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.18.1 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.18.1"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 18 || \
(major1) == 2 && (major2) == 18 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool hpc-0.67 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.67"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 67 || \
(major1) == 0 && (major2) == 67 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.2 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.2"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool pkg-config-1.7.3 */
#ifndef TOOL_VERSION_pkg_config
#define TOOL_VERSION_pkg_config "1.7.3"
#endif /* TOOL_VERSION_pkg_config */
#ifndef MIN_TOOL_VERSION_pkg_config
#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 7 || \
(major1) == 1 && (major2) == 7 && (minor) <= 3)
#endif /* MIN_TOOL_VERSION_pkg_config */
/* tool runghc-8.2.2 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "8.2.2"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 2 || \
(major1) == 8 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.36 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.36"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 36 || \
(major1) == 2 && (major2) == 36 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC"
#endif /* CURRENT_PACKAGE_KEY */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1.0.0"
#endif /* CURRENT_PACKAGE_VERSION */

View File

@ -0,0 +1,50 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -fno-warn-implicit-prelude #-}
module Paths_shadow_library (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
#if defined(VERSION_base)
#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif
#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch
version :: Version
version = Version [0,1,0,0] []
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/bin"
libdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0-9CtZODQH6nW51fwukrC8NC-tajemnicaatari"
dynlibdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2"
datadir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/share/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0"
libexecdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/libexec/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0"
sysconfdir = "/home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/etc"
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
getBinDir = catchIO (getEnv "shadow_library_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "shadow_library_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "shadow_library_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "shadow_library_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "shadow_library_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "shadow_library_sysconfdir") (\_ -> return sysconfdir)
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir ++ "/" ++ name)

View File

@ -0,0 +1,184 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package shadow-library-0.1.0.0 */
#ifndef VERSION_shadow_library
#define VERSION_shadow_library "0.1.0.0"
#endif /* VERSION_shadow_library */
#ifndef MIN_VERSION_shadow_library
#define MIN_VERSION_shadow_library(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_shadow_library */
/* package base-4.10.1.0 */
#ifndef VERSION_base
#define VERSION_base "4.10.1.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 10 || \
(major1) == 4 && (major2) == 10 && (minor) <= 1)
#endif /* MIN_VERSION_base */
/* package hxt-9.3.1.16 */
#ifndef VERSION_hxt
#define VERSION_hxt "9.3.1.16"
#endif /* VERSION_hxt */
#ifndef MIN_VERSION_hxt
#define MIN_VERSION_hxt(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 3 || \
(major1) == 9 && (major2) == 3 && (minor) <= 1)
#endif /* MIN_VERSION_hxt */
/* package hxt-xpath-9.1.2.2 */
#ifndef VERSION_hxt_xpath
#define VERSION_hxt_xpath "9.1.2.2"
#endif /* VERSION_hxt_xpath */
#ifndef MIN_VERSION_hxt_xpath
#define MIN_VERSION_hxt_xpath(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 1 || \
(major1) == 9 && (major2) == 1 && (minor) <= 2)
#endif /* MIN_VERSION_hxt_xpath */
/* package MissingH-1.4.0.1 */
#ifndef VERSION_MissingH
#define VERSION_MissingH "1.4.0.1"
#endif /* VERSION_MissingH */
#ifndef MIN_VERSION_MissingH
#define MIN_VERSION_MissingH(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 4 || \
(major1) == 1 && (major2) == 4 && (minor) <= 0)
#endif /* MIN_VERSION_MissingH */
/* package regex-posix-0.95.2 */
#ifndef VERSION_regex_posix
#define VERSION_regex_posix "0.95.2"
#endif /* VERSION_regex_posix */
#ifndef MIN_VERSION_regex_posix
#define MIN_VERSION_regex_posix(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 95 || \
(major1) == 0 && (major2) == 95 && (minor) <= 2)
#endif /* MIN_VERSION_regex_posix */
/* package shadow-library-0.1.0.0 */
#ifndef VERSION_shadow_library
#define VERSION_shadow_library "0.1.0.0"
#endif /* VERSION_shadow_library */
#ifndef MIN_VERSION_shadow_library
#define MIN_VERSION_shadow_library(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_shadow_library */
/* tool gcc-10.2.0 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "10.2.0"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 10 || \
(major1) == 10 && (major2) < 2 || \
(major1) == 10 && (major2) == 2 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-8.2.2 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "8.2.2"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 2 || \
(major1) == 8 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-8.2.2 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "8.2.2"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 2 || \
(major1) == 8 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.18.1 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.18.1"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 18 || \
(major1) == 2 && (major2) == 18 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool hpc-0.67 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.67"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 67 || \
(major1) == 0 && (major2) == 67 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.2 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.2"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool pkg-config-1.7.3 */
#ifndef TOOL_VERSION_pkg_config
#define TOOL_VERSION_pkg_config "1.7.3"
#endif /* TOOL_VERSION_pkg_config */
#ifndef MIN_TOOL_VERSION_pkg_config
#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 7 || \
(major1) == 1 && (major2) == 7 && (minor) <= 3)
#endif /* MIN_TOOL_VERSION_pkg_config */
/* tool runghc-8.2.2 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "8.2.2"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 2 || \
(major1) == 8 && (major2) == 2 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.36 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.36"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 36 || \
(major1) == 2 && (major2) == 36 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "shadow-library-0.1.0.0-9CtZODQH6nW51fwukrC8NC-tajemnicaatari"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1.0.0"
#endif /* CURRENT_PACKAGE_VERSION */

View File

@ -0,0 +1,55 @@
name: shadow-library
version: 0.1.0.0
id: shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
key: shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
license: Proprietary
maintainer: your.address@example.com
homepage: http://github.com/name/project
synopsis: Initial project template from stack
description:
Please see README.md
category: Web
author: Your name here
exposed: True
indefinite: False
exposed-modules:
ShadowLibrary.Core
abi: inplace
trusted: False
import-dirs: /home/arab/tajemnica-atari/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build
library-dirs: /home/arab/tajemnica-atari/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build
dynamic-library-dirs: /home/arab/tajemnica-atari/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build
data-dir: /home/arab/tajemnica-atari
hs-libraries: HSshadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
depends:
base-4.10.1.0 HTTP-4000.3.11-Em6gm8jEB0qEFTLVuYP9BW
hxt-9.3.1.16-tPL6nHdF96HdMUbTCizp8
hxt-http-9.1.5.2-7CwPSsHYqJaF1B9BfRABre
hxt-xpath-9.1.2.2-6gfRgquxKxZD0uf6f7DtWB
MissingH-1.4.0.1-FBwiiNWePUqJm6KnOMsQn7
monad-logger-0.3.28.5-G84SRvJt3PgHpv4Cckn4rC
mtl-2.2.2-8XubxMJDT8QLsstvlNotkc
network-uri-2.6.1.0-HFSSTRrfGehGwB5I1GqZY9
regex-pcre-0.94.4-9zkZRIThPw24AKerd342eW
regex-tdfa-1.2.3-Ij4CuSy71BbLrh9qHxLeg2
resourcet-1.2.1-4auR6IWLzw440ANnUUipcR
text-1.2.3.0-8YJjh6bMrT1Fs0AeQRa5bG time-1.8.0.2
transformers-0.5.2.0 tz-0.1.3.1-Jn2UEYc6b9b3NFhZCPAcEa
abi-depends: base-4.10.1.0=35a7f6be752ee4f7385cb5bf28677879
HTTP-4000.3.11-Em6gm8jEB0qEFTLVuYP9BW=46d0b412188690fa9c5a0c5a6a35937e
hxt-9.3.1.16-tPL6nHdF96HdMUbTCizp8=109566f7eceb6d0285871fc8e48db96c
hxt-http-9.1.5.2-7CwPSsHYqJaF1B9BfRABre=61db032f9e031b2636ed10b170aa0e90
hxt-xpath-9.1.2.2-6gfRgquxKxZD0uf6f7DtWB=c0b39f3a1265f42df559c5bbbd6cbc7e
MissingH-1.4.0.1-FBwiiNWePUqJm6KnOMsQn7=b0a2b334383ef10fa476f86e2d45d187
monad-logger-0.3.28.5-G84SRvJt3PgHpv4Cckn4rC=272fd1c67900b3af3dd0a22cc3c95404
mtl-2.2.2-8XubxMJDT8QLsstvlNotkc=ada793ec1f149425d0c0689d53e1173b
network-uri-2.6.1.0-HFSSTRrfGehGwB5I1GqZY9=0f1fa6159264b7ad163e188406b74e4a
regex-pcre-0.94.4-9zkZRIThPw24AKerd342eW=2cb4edf3e3da67c24c4722aa6ac821d2
regex-tdfa-1.2.3-Ij4CuSy71BbLrh9qHxLeg2=2576035a28205b49f80f50e62814fff1
resourcet-1.2.1-4auR6IWLzw440ANnUUipcR=08d507744dd8634f15d41444df044eaf
text-1.2.3.0-8YJjh6bMrT1Fs0AeQRa5bG=5dfe127f57f4e6c8b7a3f122690f3a80
time-1.8.0.2=7cc0324e0aef789d5f0780f6640c241b
transformers-0.5.2.0=e04579c0363c9229351d1a0b394bf2d5
tz-0.1.3.1-Jn2UEYc6b9b3NFhZCPAcEa=a81d75e450d1c5453729385482302ee2
haddock-interfaces: /home/arab/tajemnica-atari/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/doc/html/shadow-library/shadow-library.haddock
haddock-html: /home/arab/tajemnica-atari/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/doc/html/shadow-library

Binary file not shown.

View File

@ -0,0 +1,4 @@
/home/arab/tajemnica-atari/shadow-library.cabal:
hash: 714bd61ef22b868b423c5ab32edbbca76e241ecb2075dced142701878c34217a
/home/arab/tajemnica-atari/app/tajemnicaatari.hs:
hash: bddee13012273b21b906bb8fbd691a21a711b4572235a59201b82b3843f2c862

View File

@ -0,0 +1,4 @@
/home/arab/tajemnica-atari/ShadowLibrary/Core.hs:
hash: 8019eaf79045a202e2560acc4fcece89d6f3b290c931edf2c6443fbf96954189
/home/arab/tajemnica-atari/shadow-library.cabal:
hash: 714bd61ef22b868b423c5ab32edbbca76e241ecb2075dced142701878c34217a

View File

@ -0,0 +1 @@
Just used for its modification time

View File

@ -0,0 +1,55 @@
name: shadow-library
version: 0.1.0.0
id: shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
key: shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
license: Proprietary
maintainer: your.address@example.com
homepage: http://github.com/name/project
synopsis: Initial project template from stack
description:
Please see README.md
category: Web
author: Your name here
exposed: True
indefinite: False
exposed-modules:
ShadowLibrary.Core
abi: 7996a15f3c2db681c1062e049e1b1a98
trusted: False
import-dirs: /home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
library-dirs: /home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
dynamic-library-dirs: /home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/lib/x86_64-linux-ghc-8.2.2
data-dir: /home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/share/x86_64-linux-ghc-8.2.2/shadow-library-0.1.0.0
hs-libraries: HSshadow-library-0.1.0.0-5aC4GQbmpkUJXPfTJcpvSC
depends:
base-4.10.1.0 HTTP-4000.3.11-Em6gm8jEB0qEFTLVuYP9BW
hxt-9.3.1.16-tPL6nHdF96HdMUbTCizp8
hxt-http-9.1.5.2-7CwPSsHYqJaF1B9BfRABre
hxt-xpath-9.1.2.2-6gfRgquxKxZD0uf6f7DtWB
MissingH-1.4.0.1-FBwiiNWePUqJm6KnOMsQn7
monad-logger-0.3.28.5-G84SRvJt3PgHpv4Cckn4rC
mtl-2.2.2-8XubxMJDT8QLsstvlNotkc
network-uri-2.6.1.0-HFSSTRrfGehGwB5I1GqZY9
regex-pcre-0.94.4-9zkZRIThPw24AKerd342eW
regex-tdfa-1.2.3-Ij4CuSy71BbLrh9qHxLeg2
resourcet-1.2.1-4auR6IWLzw440ANnUUipcR
text-1.2.3.0-8YJjh6bMrT1Fs0AeQRa5bG time-1.8.0.2
transformers-0.5.2.0 tz-0.1.3.1-Jn2UEYc6b9b3NFhZCPAcEa
abi-depends: base-4.10.1.0=35a7f6be752ee4f7385cb5bf28677879
HTTP-4000.3.11-Em6gm8jEB0qEFTLVuYP9BW=46d0b412188690fa9c5a0c5a6a35937e
hxt-9.3.1.16-tPL6nHdF96HdMUbTCizp8=109566f7eceb6d0285871fc8e48db96c
hxt-http-9.1.5.2-7CwPSsHYqJaF1B9BfRABre=61db032f9e031b2636ed10b170aa0e90
hxt-xpath-9.1.2.2-6gfRgquxKxZD0uf6f7DtWB=c0b39f3a1265f42df559c5bbbd6cbc7e
MissingH-1.4.0.1-FBwiiNWePUqJm6KnOMsQn7=b0a2b334383ef10fa476f86e2d45d187
monad-logger-0.3.28.5-G84SRvJt3PgHpv4Cckn4rC=272fd1c67900b3af3dd0a22cc3c95404
mtl-2.2.2-8XubxMJDT8QLsstvlNotkc=ada793ec1f149425d0c0689d53e1173b
network-uri-2.6.1.0-HFSSTRrfGehGwB5I1GqZY9=0f1fa6159264b7ad163e188406b74e4a
regex-pcre-0.94.4-9zkZRIThPw24AKerd342eW=2cb4edf3e3da67c24c4722aa6ac821d2
regex-tdfa-1.2.3-Ij4CuSy71BbLrh9qHxLeg2=2576035a28205b49f80f50e62814fff1
resourcet-1.2.1-4auR6IWLzw440ANnUUipcR=08d507744dd8634f15d41444df044eaf
text-1.2.3.0-8YJjh6bMrT1Fs0AeQRa5bG=5dfe127f57f4e6c8b7a3f122690f3a80
time-1.8.0.2=7cc0324e0aef789d5f0780f6640c241b
transformers-0.5.2.0=e04579c0363c9229351d1a0b394bf2d5
tz-0.1.3.1-Jn2UEYc6b9b3NFhZCPAcEa=a81d75e450d1c5453729385482302ee2
haddock-interfaces: /home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/doc/shadow-library-0.1.0.0/shadow-library.haddock
haddock-html: /home/arab/tajemnica-atari/.stack-work/install/x86_64-linux-tinfo6/d71b3e2454b12a341d631285d8a546a45a73f1e0125cdb4008bd2d9f7a6a35bf/8.2.2/doc/shadow-library-0.1.0.0

BIN
.stack-work/stack.sqlite3 Normal file

Binary file not shown.

1
LICENSE Normal file
View File

@ -0,0 +1 @@
Prioprietary.

304
ShadowLibrary/Core.hs Normal file
View File

@ -0,0 +1,304 @@
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies, OverloadedStrings #-}
{-# LANGUAGE GADTs, FlexibleContexts #-}
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module ShadowLibrary.Core where
-- import Database.Persist
-- import Database.Persist.TH
-- import Database.Persist.Postgresql
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Logger (runNoLoggingT)
import Control.Monad.Trans.Resource (runResourceT)
import Control.Monad.Reader
import Data.Time
import Data.Time.Calendar
import Data.Time.LocalTime
import Data.Time.Zones
import Data.Time.Zones.All
import Data.String.Utils (strip)
import Data.List.Utils as DLU
import Text.XML.HXT.Core
import Network.HTTP
import Network.URI
import Control.Monad.Trans.Maybe
import Control.Monad
import Data.Tree.NTree.TypeDefs
import Data.Maybe
import Control.Monad.Trans
import Text.XML.HXT.XPath
-- import Text.XML.HXT.Curl
import Text.XML.HXT.HTTP
import Text.Regex.TDFA
import Data.List (isInfixOf, intercalate)
import Data.List.Utils (replace)
-- import Network.Curl.Opts
polishTimeZone = TimeZone {
timeZoneMinutes = 120,
timeZoneSummerOnly = True,
timeZoneName = ""}
openUrl :: String -> MaybeT IO String
openUrl url = case parseURI url of
Nothing -> fail ""
Just u -> liftIO (getResponseBody =<< simpleHTTP (mkRequest GET u))
getWebPage :: String -> IO (IOSArrow XmlTree (NTree XNode))
getWebPage url = do
contents <- runMaybeT $ openUrl url
return $ readString [withParseHTML yes, withWarnings no] (fromMaybe "" contents)
downloadDocument = readFromDocument [withParseHTML yes,
withWarnings no,
withEncodingErrors no,
withPreserveComment yes,
withStrictInput yes,
withHTTP []
-- withCurl [("curl--user-agent","AMU Digital Libraries Indexing Agent")]
]
downloadDocumentWithEncoding enc = readFromDocument [withParseHTML yes,
withWarnings no,
withEncodingErrors no,
withPreserveComment yes,
withInputEncoding enc,
withHTTP []]
-- withCurl []]
downloadXmlDocument = readFromDocument [withWarnings no,
withEncodingErrors no,
withHTTP []]
-- withCurl [] ]
data ShadowLibrary = ShadowLibrary { logoUrl :: Maybe String,
lname :: String,
abbrev :: String,
webpage :: String,
lLevel :: Int }
data ShadowItem = ShadowItem {
url :: Maybe String,
title :: String,
itype :: String,
originalDate :: Maybe String,
creator :: Maybe String,
format :: Maybe String,
lang :: Maybe String,
finalUrl :: String,
description :: Maybe String
} deriving (Show)
defaultShadowItem url title = ShadowItem {
url = Just url,
title = title,
itype = "periodical",
originalDate = Nothing,
creator = Nothing,
format = Just "pdf",
lang = Just "pol",
finalUrl = url,
description = Nothing }
getDuration :: Maybe String -> (Maybe UTCTime, Maybe UTCTime)
getDuration Nothing = (Nothing, Nothing)
getDuration (Just date) =
case date =~~ ("^(1[6789]|20)[0-9][0-9]$" :: String) of
Just year -> (Just (yearStart year), Just (yearEnd year))
otherwise ->
case date =~~ ("^((1[789]|20)[0-9][0-9])-(0[1-9]|1[0-2])$" :: String) :: Maybe [[String]] of
Just [[_, year, _, month]] -> (Just (monthStart year month), Just (monthEnd year month))
otherwise ->
case date =~~ ("^((1[789]|20)[0-9][0-9])-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$" :: String) :: Maybe [[String]] of
Just [[_, year, _, month, day]] -> (Just (dayStart year month day), Just (dayEnd year month day))
otherwise ->
case date =~~ ("^((1[789]|20)[0-9][0-9])-((1[789]|20)[0-9][0-9])$" :: String) :: Maybe [[String]] of
Just [[_, yearb, _, yeare, _]] -> (Just (yearStart yearb), Just (yearEnd yeare))
otherwise -> (Nothing, Nothing)
where
yearAsInteger year = (read year) :: Integer
monthAsInt month = (read month) :: Int
dayAsInt day = (read day) :: Int
yearStart year = localTimeToTimeStamp $ LocalTime {
localDay = fromGregorian (yearAsInteger year) 1 1,
localTimeOfDay = midnight }
yearEnd year = localTimeToTimeStamp $ LocalTime {
localDay = fromGregorian (yearAsInteger year) 12 31,
localTimeOfDay = lastSecond }
monthStart year month = localTimeToTimeStamp $ LocalTime {
localDay = fromGregorian (yearAsInteger year) (monthAsInt month) 1,
localTimeOfDay = midnight }
monthEnd year month = localTimeToTimeStamp $ LocalTime {
localDay = fromGregorian (yearAsInteger year) (monthAsInt month) 31,
localTimeOfDay = lastSecond }
dayStart year month day = localTimeToTimeStamp $ LocalTime {
localDay = fromGregorian (yearAsInteger year) (monthAsInt month) (dayAsInt day),
localTimeOfDay = midnight }
dayEnd year month day = localTimeToTimeStamp $ LocalTime {
localDay = fromGregorian (yearAsInteger year) (monthAsInt month) (dayAsInt day),
localTimeOfDay = lastSecond }
lastSecond = TimeOfDay {todHour = 23, todMin = 59, todSec = 59 }
localTimeToTimeStamp ltime = localTimeToUTCTZ (tzByLabel Europe__Warsaw) ltime
-- zonedTimeToUTC $ ZonedTime {
-- zonedTimeToLocalTime = ltime,
-- zonedTimeZone = timeZoneForUTCTime Europe__Warsaw }
extractLinks xpathCondition = (downloadDocument &&& this)
>>> first (getXPathTrees xpathCondition
>>> getAttrValue "href")
>>> expandURIFixed
extractLinksGeneralized xpathCondition attr = (downloadDocument &&& this)
>>> first (getXPathTrees xpathCondition
>>> getAttrValue attr)
>>> expandURIFixed
rotateSecTh ((a, b), c) = ((a, c), b)
extractLinksWithText xpathCondition = (downloadDocument &&& this)
>>> first (getXPathTrees xpathCondition
>>> (getAttrValue "href"
&&& (listA (deep isText >>> getText)
>>> arr (intercalate " "))))
>>> arr rotateSecTh
>>> first expandURIFixed
extractLinksWithTitle xpathCondition = (downloadDocument &&& this)
>>> first (getXPathTrees xpathCondition
>>> (getAttrValue "href"
&&& getAttrValue "title"))
>>> arr rotateSecTh
>>> first expandURIFixed
urlPreFixer = arr (Data.List.Utils.replace "[" stupidLeftBracketMarker . Data.List.Utils.replace "]" stupidRightBracketMarker)
urlPostFixer = arr (Data.List.Utils.replace stupidLeftBracketMarker "%5B" . Data.List.Utils.replace stupidRightBracketMarker "%5D")
stupidLeftBracketMarker = "ddsfdfdfdfgfgfrrtrtrrtr"
stupidRightBracketMarker = "wqweweerererrtrtrtrtrtr"
expandURIFixed = (urlPreFixer *** urlPreFixer) >>> expandURI >>> urlPostFixer
extractText = (listA (deep isText >>> getText)
>>> arr (intercalate " "))
loopNext extract xpathConditionForNext = initialStep
>>> loopNextCore extract xpathConditionForNext
>>> arr fst
>>> unlistA
initialList :: [(String, a)]
initialList = []
initialStep = arr (const initialList) &&& this
loopNextCore extract xpathConditionForNext = second
(listA extract &&& extractNext xpathConditionForNext)
>>> arr expandList
>>> ifP (nextFound)
(second (arr fromJust >>> (downloadDocument &&& this))
>>> loopNextCore extract xpathConditionForNext)
(this)
nextFound :: ([(String,a)], Maybe String) -> Bool
nextFound (_, Just _) = True
nextFound (_, Nothing) = False
expandList (l, (e, n)) = (l ++ e, n)
extractNext xpathConditionForNext = listA
(first (getXPathTrees ("(" ++ xpathConditionForNext ++ ")[1]")
>>> getAttrValue "href")
>>> expandURIFixed)
>>> arr listToMaybe
extractFormat :: String -> Maybe String
extractFormat finalUrl
| ".gif" `isInfixOf` finalUrl = Just "gif"
| ".jpg" `isInfixOf` finalUrl = Just "jpg"
| ".djvu" `isInfixOf` finalUrl = Just "djvu"
| ".pdf" `isInfixOf` finalUrl = Just "pdf"
| ".doc" `isInfixOf` finalUrl = Just "doc"
| otherwise = Nothing
baseMonthNameToNumber :: String -> Maybe String
baseMonthNameToNumber "styczeń" = Just "01"
baseMonthNameToNumber "styczen" = Just "01"
baseMonthNameToNumber "stycznia" = Just "01"
baseMonthNameToNumber "luty" = Just "02"
baseMonthNameToNumber "lutego" = Just "02"
baseMonthNameToNumber "marzec" = Just "03"
baseMonthNameToNumber "marca" = Just "03"
baseMonthNameToNumber "kwiecień" = Just "04"
baseMonthNameToNumber "kwiecien" = Just "04"
baseMonthNameToNumber "kwietnia" = Just "04"
baseMonthNameToNumber "maj" = Just "05"
baseMonthNameToNumber "maja" = Just "05"
baseMonthNameToNumber "czerwiec" = Just "06"
baseMonthNameToNumber "czeerwiec" = Just "06"
baseMonthNameToNumber "czerwca" = Just "06"
baseMonthNameToNumber "lipiec" = Just "07"
baseMonthNameToNumber "lipca" = Just "07"
baseMonthNameToNumber "sierpień" = Just "08"
baseMonthNameToNumber "sierpien" = Just "08"
baseMonthNameToNumber "sierpnia" = Just "08"
baseMonthNameToNumber "wrzesień" = Just "09"
baseMonthNameToNumber "wrzesien" = Just "09"
baseMonthNameToNumber "września" = Just "09"
baseMonthNameToNumber "wrzesnia" = Just "09"
baseMonthNameToNumber "październik" = Just "10"
baseMonthNameToNumber "pażdziernik" = Just "10"
baseMonthNameToNumber "pazdziernik" = Just "10"
baseMonthNameToNumber "października" = Just "10"
baseMonthNameToNumber "pazdziernika" = Just "10"
baseMonthNameToNumber "listopad" = Just "11"
baseMonthNameToNumber "listopada" = Just "11"
baseMonthNameToNumber "grudzień" = Just "12"
baseMonthNameToNumber "grudzien" = Just "12"
baseMonthNameToNumber "grudnia" = Just "12"
baseMonthNameToNumber "jesien" = Just "10"
baseMonthNameToNumber _ = Nothing
extractYear :: String -> Maybe String
extractYear n =
case n =~~ ("(1[6789]|20)[0-9][0-9]" :: String) of
Just year -> Just year
otherwise -> Nothing
joinAlts :: [String] -> String
joinAlts = intercalate " // "
clean = arr (DLU.replace "\n" "")
>>> arr strip
extractItems shadowLibrary start extractor = do
page <- getWebPage start
items <- runX $ extractor start page
-- insertIntoDatabase shadowLibrary items
putStrLn (show items)
extractItemsStartingFromUrl shadowLibrary start extractor = do
items <- runX $ (arr (const start) >>> setTraceLevel 1 >>> extractor)
-- insertIntoDatabase shadowLibrary items
mapM_ (putStrLn . show) items

44
app/tajemnicaatari.hs Normal file
View File

@ -0,0 +1,44 @@
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
import ShadowLibrary.Core
import Text.XML.HXT.Core
import Text.XML.HXT.XPath
-- import Text.XML.HXT.Curl
import Data.List
import Data.List.Utils (replace)
import Text.Regex.Posix
import Text.Printf
extractRecords = extractLinksWithText "//a[@class='ramka']" -- pary adres-tytuł
>>> first (extractLinksWithText "//div/a[contains(@href, '.zip') and not (contains(@href,'text_offline.zip'))]") -- tutaj wybieramy paczki zip z plikami DjVu, jeśli byśmy chcieli bezpośrednio format DjVu wystarczy trochę zmienić zapytanie XPatha.
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
toShadowItem :: ((String, String), String) -> ShadowItem
toShadowItem ((url, articleTitle), yearlyTitle) =
(defaultShadowItem url title) {
originalDate = Just date,
itype = "periodical",
format = Just "zip",
finalUrl = url
}
where title = "Tajemnica Atari " ++ yearlyTitle ++ " " ++ (replace "\r\n" "" (replace "\r\n " "" articleTitle))
date = getDate url
getDate url =
case url =~~ "/([1-9]_9[0-9]|1[0-2]_9[0-9]|[1-9]-[1-9]_9[0-9]|1[0-2]-1[0-2]_9[0-9])/" :: Maybe [[String]] of
Just [[_, year]] -> year
otherwise -> error $ "unexpected url: " ++ url
main = do
let start = "http://krap.pl/mirrorz/atari/horror.mirage.com.pl/pixel/"
let shadowLibrary = ShadowLibrary {logoUrl=Nothing,
lname="Tajemnica Atari",
abbrev="TA",
lLevel=0,
webpage=start}
extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)

76
shadow-library.cabal Normal file
View File

@ -0,0 +1,76 @@
name: shadow-library
version: 0.1.0.0
synopsis: Initial project template from stack
description: Please see README.md
homepage: http://github.com/name/project
license: Proprietary
license-file: LICENSE
author: Your name here
maintainer: your.address@example.com
-- copyright:
category: Web
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
library
hs-source-dirs: .
exposed-modules: ShadowLibrary.Core
build-depends: base >= 4.7 && < 5
, HTTP
, hxt
, hxt-http
, hxt-xpath
, MissingH
, monad-logger
, mtl
, network-uri
, regex-pcre
, regex-tdfa
, resourcet
, text
, time
, transformers
, tz
default-language: Haskell2010
-- executable maly-modelarz-exe
-- hs-source-dirs: app
-- main-is: malymodelarz.hs
-- ghc-options: -threaded -rtsopts -with-rtsopts=-N
-- build-depends: base
-- , hxt
-- , hxt-curl
-- , hxt-xpath
-- , MissingH
-- , regex-posix
-- , shadow-library
-- default-language: Haskell2010
-- executable almanachmuszyny
-- hs-source-dirs: app
-- main-is: almanachmuszyny.hs
-- ghc-options: -threaded -rtsopts -with-rtsopts=-N
-- build-depends: base
-- , hxt
-- , hxt-xpath
-- , MissingH
-- , regex-posix
-- , shadow-library
-- default-language: Haskell2010
executable tajemnicaatari
hs-source-dirs: app
main-is: tajemnicaatari.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, hxt
, hxt-xpath
, MissingH
, regex-posix
, shadow-library
default-language: Haskell2010
source-repository head
type: git
location: https://github.com/name/project

5
stack.yaml Normal file
View File

@ -0,0 +1,5 @@
flags: {}
packages:
- '.'
extra-deps: [hxt-xpath-9.1.2.2]
resolver: lts-11.9

19
stack.yaml.lock Normal file
View File

@ -0,0 +1,19 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: hxt-xpath-9.1.2.2@sha256:9cd590ae93a04573db8f90fa4094625ebd97dded45da7667c577ce6b38a42900,1999
pantry-tree:
size: 2225
sha256: aee2f75974e868ff429b8ff349a29667536c60397098f5dfedc968d1951511bb
original:
hackage: hxt-xpath-9.1.2.2
snapshots:
- completed:
size: 507596
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/11/9.yaml
sha256: 42f472dbf06482da1b3319241f3e3b3593a45bd7d4f537d2789f21386b9b2ad3
original: lts-11.9