diff --git a/.hlint.yaml b/.hlint.yaml index dbdbf44..2accfa8 100644 Binary files a/.hlint.yaml and b/.hlint.yaml differ diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml index 6eae066..16e6a0b 100644 --- a/.stylish-haskell.yaml +++ b/.stylish-haskell.yaml @@ -57,43 +57,43 @@ steps: # - "," in fields is always aligned with "{" # - "}" is likewise always aligned with "{" # - # - records: + - records: # # How to format equals sign between type constructor and data constructor. # # Possible values: # # - "same_line" -- leave "=" AND data constructor on the same line as the type constructor. # # - "indent N" -- insert a new line and N spaces from the beginning of the next line. - # equals: "indent 2" + equals: "indent 2" # # # How to format first field of each record constructor. # # Possible values: # # - "same_line" -- "{" and first field goes on the same line as the data constructor. # # - "indent N" -- insert a new line and N spaces from the beginning of the data constructor - # first_field: "indent 2" + first_field: "indent 2" # # # How many spaces to insert between the column with "," and the beginning of the comment in the next line. - # field_comment: 2 + field_comment: 2 # # # How many spaces to insert before "deriving" clause. Deriving clauses are always on separate lines. - # deriving: 2 + deriving: 2 # # # How many spaces to insert before "via" clause counted from indentation of deriving clause # # Possible values: # # - "same_line" -- "via" part goes on the same line as "deriving" keyword. # # - "indent N" -- insert a new line and N spaces from the beginning of "deriving" keyword. - # via: "indent 2" + via: "indent 2" # # # Sort typeclass names in the "deriving" list alphabetically. - # sort_deriving: true + sort_deriving: true # # # Wheter or not to break enums onto several lines # # # # Default: false - # break_enums: false + break_enums: false # # # Whether or not to break single constructor data types before `=` sign # # # # Default: true - # break_single_constructors: true + break_single_constructors: true # # # Whether or not to curry constraints on function. # # @@ -102,7 +102,7 @@ steps: # # Instead of @allValues :: (Enum a, Bounded a) => Proxy a -> [a]@ # # # # Default: false - # curried_context: false + curried_context: true # Align the right hand side of some elements. This is quite conservative # and only applies to statements where each element occupies a single @@ -240,7 +240,7 @@ steps: # Useful for 'file' and 'group' align settings. # # Default: 4 - list_padding: 4 + list_padding: 2 # Separate lists option affects formatting of import list for type # or class. The only difference is single space between type and list @@ -330,10 +330,10 @@ steps: language_prefix: LANGUAGE # Replace tabs by spaces. This is disabled by default. - # - tabs: - # # Number of spaces to use for each tab. Default: 8, as specified by the - # # Haskell report. - # spaces: 8 + - tabs: + # Number of spaces to use for each tab. Default: 8, as specified by the + # Haskell report. + spaces: 2 # Remove trailing whitespace - trailing_whitespace: {} @@ -341,7 +341,7 @@ steps: # Squash multiple spaces between the left and right hand sides of some # elements into single spaces. Basically, this undoes the effect of # simple_align but is a bit less conservative. - # - squash: {} + # - squash: {} # A common setting is the number of columns (parts of) code will be wrapped # to. Different steps take this into account. diff --git a/hie.yaml b/hie.yaml index 444d604..ef74e43 100644 Binary files a/hie.yaml and b/hie.yaml differ diff --git a/packages/grappler/CHANGELOG.md b/packages/grappler/CHANGELOG.md new file mode 100644 index 0000000..a84e608 --- /dev/null +++ b/packages/grappler/CHANGELOG.md @@ -0,0 +1,6 @@ +# grappler + +## 0.0.1.0 + +- init package + \ No newline at end of file diff --git a/packages/grappler/LICENSE b/packages/grappler/LICENSE new file mode 100644 index 0000000..086f63c --- /dev/null +++ b/packages/grappler/LICENSE @@ -0,0 +1,15 @@ +grappler +Copyright (C) 2021 Cigaret + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . \ No newline at end of file diff --git a/packages/grappler/README.md b/packages/grappler/README.md new file mode 100644 index 0000000..a668355 --- /dev/null +++ b/packages/grappler/README.md @@ -0,0 +1,12 @@ +# grappler + +周期性检索「中华人民共和国中央人民政府」网站指定页面的数据条目,根据标题判断是否是新数据,将新数据写入目标数据库中。 + +监测页面如下: + +- [首页 > 政策 > 最新](http://www.gov.cn/zhengce/zuixin.htm) + 可能在域名解析层面设置了访问限制,直接访问 IP 地址可以不设代理拿到数据([IP 地址](http://182.18.80.137:80/zhengce/zuixin.htm))。 +- [太原市人民政府 > 政府信息公开 > 法定主动公开内容 > 国民经济和社会发展规划](http://www.taiyuan.gov.cn/fzlm/gkmlpt/zdgk/index.shtml?chan=25) + 很奇怪,这个没有访问限制,但数据是动态加载的,需要直接请求接口。 + [IP 地址](http://221.204.12.122:80/fzlm/gkmlpt/zdgk/index.shtml?chan=25)。 + [数据地址](http://taiyuan.gov.cn/intertidwebapp/govChanInfo/getDocuments?Index=1&pageSize=20&siteId=1&ChannelType=1&KeyWord=&KeyWordType=&chanId=25&order=1)。 diff --git a/packages/grappler/Setup.hs b/packages/grappler/Setup.hs new file mode 100644 index 0000000..2b5d1c0 --- /dev/null +++ b/packages/grappler/Setup.hs @@ -0,0 +1,3 @@ +import Distribution.Simple +main = defaultMain + \ No newline at end of file diff --git a/packages/grappler/app/Gov/Taiyuan.hs b/packages/grappler/app/Gov/Taiyuan.hs new file mode 100644 index 0000000..2092501 --- /dev/null +++ b/packages/grappler/app/Gov/Taiyuan.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Gov.Taiyuan where + +import qualified Data.ByteString.Lazy.UTF8 as UTF8 +import Data.Foldable +import Network.HTTP.Client +import Network.HTTP.Types.Header + +type UrlString = String +type TargetUrls = [UrlString] + +targetUrls :: TargetUrls +targetUrls = [ + "http://taiyuan.gov.cn/intertidwebapp/govChanInfo/getDocuments?Index=1&pageSize=20&siteId=1&ChannelType=1&KeyWord=&KeyWordType=&chanId=25&order=1" + ] + +-- 添加通用的 Proxy 配置 +setCommonProxy :: ManagerSettings -> ManagerSettings +setCommonProxy = managerSetProxy (useProxy Proxy { + proxyHost = "127.0.0.1", + proxyPort = 10809 + }) + +-- 添加通用的 Manager 设置 +setCommonManager :: ManagerSettings -> ManagerSettings +setCommonManager settings = settings { managerResponseTimeout = responseTimeoutMicro 30000000 } + +prepareRequests = map (\url -> do + manager <- newManager $ setCommonManager defaultManagerSettings + initRequest <- parseRequest url + let request = initRequest { + method = "GET", + requestHeaders = [ + -- 不设置 User-Agent 也可以拿到数据 + (hUserAgent, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38") + ] + } + response <- httpLbs request manager + return (url, request, response) + ) diff --git a/packages/grappler/app/Gov/Top.hs b/packages/grappler/app/Gov/Top.hs new file mode 100644 index 0000000..1fca7b1 --- /dev/null +++ b/packages/grappler/app/Gov/Top.hs @@ -0,0 +1,132 @@ +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} + +module Gov.Top + ( grap + ) where + +import Control.Concurrent +import Control.Monad +import qualified Data.ByteString.Lazy.UTF8 as UTF8 +import Data.Char +import Network.HTTP.Client +import Network.HTTP.Types.Header +import Text.HTML.TagSoup + +type Name = String +type UrlString = String +data Target + = Target + { name :: Name + , url :: UrlString + } + deriving (Show) +type Targets = [Target] + +targets :: Targets +targets = [Target "Zhengce" "http://www.gov.cn/zhengce/zuixin.htm"] + +-- 添加通用的 Proxy 配置 +setCommonProxy :: ManagerSettings -> ManagerSettings +setCommonProxy = managerSetProxy (useProxy Proxy { + proxyHost = "127.0.0.1", + proxyPort = 10809 + }) + +-- 添加通用的 Manager 设置 +setCommonManager :: ManagerSettings -> ManagerSettings +setCommonManager settings = settings { managerResponseTimeout = responseTimeoutMicro (30 * 1000000) } + +type RequestResponse = Response UTF8.ByteString +data RequestResult + = RequestResult + { target :: Target + , request :: Request + , response :: RequestResponse + } + deriving (Show) + +prepareRequests :: [Target] -> [IO RequestResult] +prepareRequests = map (\target -> do + + manager <- newManager $ setCommonManager defaultManagerSettings + + initRequest <- parseRequest $ url target + let request = initRequest { + method = "GET", + requestHeaders = [ + -- 不设置 User-Agent 也可以拿到数据 + (hUserAgent, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38") + ] + } + + response <- httpLbs request manager + + return (RequestResult target request response) + ) + +execRequest :: IO [(Target, Request, RequestResponse, String)] +execRequest = do + responses <- sequenceA $ prepareRequests targets + traverse (\RequestResult { target, request, response } -> do + putStrLn $ "The target url was:" ++ url target + putStrLn $ "The request info was:" ++ show request + putStrLn $ "The response status was: " ++ show (responseStatus response) + + let body = UTF8.toString $ responseBody response + + writeFile ("./packages/grappler/data/" ++ "TopGov" ++ ".txt") body + + putStrLn "Done" + + return (target, request, response, body)) responses + +parseBody :: String -> [Tag String] +parseBody = parseTags + +extractList :: [Tag String] -> [[Tag String]] +extractList = + map ( + concat . + (\tags -> [ + (take 2 . dropWhile (~/= ("" :: String))) tags, + (take 1 . drop 1 . dropWhile (~/= TagOpen "span" [("class" :: String,"date")])) tags + ]) . + takeWhile (~/= ("" :: String)) + ) . + sections (~== ("

" :: String)) . + takeWhile (~/= TagOpen "span" [("class" :: String, "public_more")]) . + dropWhile (~/= TagOpen "div" [("class" :: String, "news_box")] ) + +newtype Item + = Item (String, String, String) +extractData :: [Tag String] -> Item +extractData tags = Item (title, url, date) + where + url = fromAttrib "href" . head $ tags + title = fromTagText (tags !! 1) + date = fromTagText (tags !! 2) + +instance Show Item where + show (Item (title, url , date)) = "(" ++ title ++ ", " ++ url ++ ", " ++ date ++ ")" + +formatData :: Item -> Item +formatData (Item (title, url, date)) = Item (formatTitle title, formatUrl url, formatDate date) + where + formatTitle = trim + -- 有的连接没有 domain,需要进行补全 + formatUrl [] = [] + formatUrl ('/':xs) = trim $ "http://www.gov.cn/" ++ xs + formatUrl u = trim u + formatDate = trim + trim = filter (not . isSpace) + +grap :: IO () +grap = forever $ + forkIO (do + [(target, _, _, body)] <- execRequest + print target + let tags = map (formatData . extractData) . extractList $ parseBody body + print tags + writeFile "./packages/grappler/data/tags.tmp" (show tags)) + >> threadDelay (60 * 10 * 1000000) diff --git a/packages/grappler/app/Main.hs b/packages/grappler/app/Main.hs new file mode 100644 index 0000000..8591e3a --- /dev/null +++ b/packages/grappler/app/Main.hs @@ -0,0 +1,14 @@ +#!/usr/bin/env stack +{-stack + script + --resolver lts-18.6 + --package utf8-string + --package http-client,http-conduit,http-types + --package tagsoup +-} + +import qualified Gov.Top as Top + +main :: IO () +main = do + Top.grap diff --git a/packages/grappler/data/TopGov.txt b/packages/grappler/data/TopGov.txt new file mode 100644 index 0000000..06fb227 --- /dev/null +++ b/packages/grappler/data/TopGov.txt @@ -0,0 +1,807 @@ + + + + + + + +最新政策 +_ + 政策 +_中国政府网 + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+
+ + + + + + +
+
+ +
+ + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + + +
+ + +
+ + + + \ No newline at end of file diff --git a/packages/grappler/data/tags.tmp b/packages/grappler/data/tags.tmp new file mode 100644 index 0000000..93125db --- /dev/null +++ b/packages/grappler/data/tags.tmp @@ -0,0 +1 @@ +[(国务院关于辽宁沿海经济带高质量发展规划的批复, http://www.gov.cn/zhengce/content/2021-09/18/content_5638243.htm, 2021-09-18),(国务院办公厅关于成立中关村论坛组织委员会和执行委员会的通知, http://www.gov.cn/zhengce/content/2021-09/17/content_5638049.htm, 2021-09-17),(国务院关于全国高标准农田建设规划(2021—2030年)的批复, http://www.gov.cn/zhengce/content/2021-09/16/content_5637565.htm, 2021-09-16),(中共中央办公厅国务院办公厅印发《关于加强网络文明建设的意见》, http://www.gov.cn/zhengce/2021-09/14/content_5637195.htm, 2021-09-14),(国务院关于东北全面振兴“十四五”实施方案的批复, http://www.gov.cn/zhengce/content/2021-09/13/content_5637015.htm, 2021-09-13),(中共中央办公厅国务院办公厅印发《关于深化生态保护补偿制度改革的意见》, http://www.gov.cn/zhengce/2021-09/12/content_5636905.htm, 2021-09-12),(中共中央国务院印发《全面深化前海深港现代服务业合作区改革开放方案》, http://www.gov.cn/zhengce/2021-09/06/content_5635728.htm, 2021-09-06),(中共中央国务院印发《横琴粤澳深度合作区建设总体方案》, http://www.gov.cn/zhengce/2021-09/05/content_5635547.htm, 2021-09-05),(中办国办印发《关于在城乡建设中加强历史文化保护传承的意见》, http://www.gov.cn/zhengce/2021-09/03/content_5635308.htm, 2021-09-03),(国务院印发关于推进自由贸易试验区贸易投资便利化改革创新若干措施的通知, http://www.gov.cn/zhengce/content/2021-09/03/content_5635110.htm, 2021-09-03),(国务院关于印发“十四五”就业促进规划的通知, http://www.gov.cn/zhengce/content/2021-08/27/content_5633714.htm, 2021-08-27),(国务院办公厅关于同意广东、香港、澳门承办2025年第十五届全国运动会的函, http://www.gov.cn/zhengce/content/2021-08/26/content_5633527.htm, 2021-08-26),(中华人民共和国市场主体登记管理条例, http://www.gov.cn/zhengce/content/2021-08/24/content_5632964.htm, 2021-08-24),(国务院办公厅关于同意建立扶持个体工商户发展部际联席会议制度的函, http://www.gov.cn/zhengce/content/2021-08/24/content_5632933.htm, 2021-08-24),(国务院办公厅关于进一步规范财务审计秩序促进注册会计师行业健康发展的意见, http://www.gov.cn/zhengce/content/2021-08/23/content_5632714.htm, 2021-08-23),(国务院办公厅关于加快农村寄递物流体系建设的意见, http://www.gov.cn/zhengce/content/2021-08/20/content_5632311.htm, 2021-08-20),(关键信息基础设施安全保护条例, http://www.gov.cn/zhengce/content/2021-08/17/content_5631671.htm, 2021-08-17),(国务院办公厅关于改革完善中央财政科研经费管理的若干意见, http://www.gov.cn/zhengce/content/2021-08/13/content_5631102.htm, 2021-08-13),(中办国办印发《关于进一步加强非物质文化遗产保护工作的意见》, http://www.gov.cn/zhengce/2021-08/12/content_5630974.htm, 2021-08-12),(中共中央国务院印发《法治政府建设实施纲要(2021-2025年)》, http://www.gov.cn/zhengce/2021-08/11/content_5630802.htm, 2021-08-11),(建设工程抗震管理条例, http://www.gov.cn/zhengce/content/2021-08/04/content_5629341.htm, 2021-08-04),(国务院关于印发全民健身计划(2021—2025年)的通知, http://www.gov.cn/zhengce/content/2021-08/03/content_5629218.htm, 2021-08-03),(《中共中央关于加强新时代检察机关法律监督工作的意见》发布, http://www.gov.cn/zhengce/2021-08/02/content_5629060.htm, 2021-08-02),(国务院办公厅关于完善科技成果评价机制的指导意见, http://www.gov.cn/zhengce/content/2021-08/02/content_5628987.htm, 2021-08-02),(中华人民共和国土地管理法实施条例, http://www.gov.cn/zhengce/content/2021-07/30/content_5628461.htm, 2021-07-30),(中办国办印发《关于进一步减轻义务教育阶段学生作业负担和校外培训负担的意见》, http://www.gov.cn/zhengce/2021-07/24/content_5627132.htm, 2021-07-24),(中共中央国务院关于新时代推动中部地区高质量发展的意见, http://www.gov.cn/zhengce/2021-07/22/content_5626642.htm, 2021-07-22),(生猪屠宰管理条例, http://www.gov.cn/zhengce/content/2021-07/22/content_5626534.htm, 2021-07-22),(国务院关于印发“十四五”残疾人保障和发展规划的通知, http://www.gov.cn/zhengce/content/2021-07/21/content_5626391.htm, 2021-07-21),(中共中央国务院关于优化生育政策促进人口长期均衡发展的决定, http://www.gov.cn/zhengce/2021-07/20/content_5626190.htm, 2021-07-20),(国务院办公厅关于印发全国深化“放管服”改革着力培育和激发市场主体活力电视电话会议重点任务分工方案的通知, http://www.gov.cn/zhengce/content/2021-07/20/content_5626165.htm, 2021-07-20),(中共中央国务院关于支持浦东新区高水平改革开放打造社会主义现代化建设引领区的意见, http://www.gov.cn/zhengce/2021-07/15/content_5625279.htm, 2021-07-15),(中共中央国务院印发《关于新时代加强和改进思想政治工作的意见》, http://www.gov.cn/zhengce/2021-07/12/content_5624392.htm, 2021-07-12),(中共中央国务院关于加强基层治理体系和治理能力现代化建设的意见, http://www.gov.cn/zhengce/2021-07/11/content_5624201.htm, 2021-07-11),(国务院办公厅关于加快发展外贸新业态新模式的意见, http://www.gov.cn/zhengce/content/2021-07/09/content_5623826.htm, 2021-07-09),(国务院办公厅关于同意河北、浙江、湖北省开展行政备案规范管理改革试点的复函, http://www.gov.cn/zhengce/content/2021-07/07/content_5623007.htm, 2021-07-07),(中共中央办公厅国务院办公厅印发《关于依法从严打击证券违法活动的意见》, http://www.gov.cn/zhengce/2021-07/06/content_5622763.htm, 2021-07-06),(中共中央办公厅发出通知要求认真学习贯彻习近平总书记在庆祝中国共产党成立100周年大会上的重要讲话精神, http://www.gov.cn/zhengce/2021-07/03/content_5622269.htm, 2021-07-03),(国务院办公厅关于加快发展保障性租赁住房的意见, http://www.gov.cn/zhengce/content/2021-07/02/content_5622027.htm, 2021-07-02),(中共中央关于表彰全国优秀共产党员、全国优秀党务工作者和全国先进基层党组织的决定, http://www.gov.cn/zhengce/2021-06/29/content_5621512.htm, 2021-06-29),(中共中央关于授予“七一勋章”的决定, http://www.gov.cn/zhengce/2021-06/29/content_5621469.htm, 2021-06-29),(国务院关于印发全民科学素质行动规划纲要(2021—2035年)的通知, http://www.gov.cn/zhengce/content/2021-06/25/content_5620813.htm, 2021-06-25),(国务院办公厅关于印发深化医药卫生体制改革2021年重点工作任务的通知, http://www.gov.cn/zhengce/content/2021-06/17/content_5618799.htm, 2021-06-17),(中共中央国务院转发两部门关于开展法治宣传教育的第八个五年规划, http://www.gov.cn/zhengce/2021-06/15/content_5618254.htm, 2021-06-15),(国务院办公厅关于文化市场综合行政执法有关事项的通知, http://www.gov.cn/zhengce/content/2021-06/15/content_5617942.htm, 2021-06-15),(国务院关于同意将安徽省黟县列为国家历史文化名城的批复, http://www.gov.cn/zhengce/content/2021-06/15/content_5617936.htm, 2021-06-15),(国务院办公厅关于印发国务院2021年度立法工作计划的通知, http://www.gov.cn/zhengce/content/2021-06/11/content_5617194.htm, 2021-06-11),(中共中央国务院关于支持浙江高质量发展建设共同富裕示范区的意见, http://www.gov.cn/zhengce/2021-06/10/content_5616833.htm, 2021-06-10),(国务院关于公布第五批国家级非物质文化遗产代表性项目名录的通知, http://www.gov.cn/zhengce/content/2021-06/10/content_5616457.htm, 2021-06-10),(中共中央办公厅国务院办公厅印发《关于深化国有文艺院团改革的意见》, http://www.gov.cn/zhengce/2021-06/07/content_5616054.htm, 2021-06-07),(国务院同意将α-苯乙酰乙酸甲酯等6种物质列入易制毒化学品品种目录, http://www.gov.cn/zhengce/content/2021-06/07/content_5615890.htm, 2021-06-07),(国务院办公厅转发《关于加强扶贫项目资产后续管理的指导意见》, http://www.gov.cn/zhengce/content/2021-06/04/content_5615474.htm, 2021-06-04),(国务院办公厅关于推动公立医院高质量发展的意见, http://www.gov.cn/zhengce/content/2021-06/04/content_5615473.htm, 2021-06-04),(国务院关于深化“证照分离”改革进一步激发市场主体发展活力的通知, http://www.gov.cn/zhengce/content/2021-06/03/content_5615031.htm, 2021-06-03),(中共中央印发《中国共产党组织工作条例》, http://www.gov.cn/zhengce/2021-06/02/content_5615053.htm, 2021-06-02),(国务院办公厅关于科学绿化的指导意见, http://www.gov.cn/zhengce/content/2021-06/02/content_5614922.htm, 2021-06-02),(中共中央关于加强对“一把手”和领导班子监督的意见, http://www.gov.cn/zhengce/2021-06/01/content_5614784.htm, 2021-06-01),(国务院办公厅转发交通运输部等单位关于加强铁路沿线安全环境治理工作意见的通知, http://www.gov.cn/zhengce/content/2021-06/01/content_5614662.htm, 2021-06-01),(国务院办公厅关于成立中国国际服务贸易交易会组织委员会和执行委员会的通知, http://www.gov.cn/zhengce/content/2021-06/01/content_5614659.htm, 2021-06-01),(中共中央办公厅印发《关于中央企业在完善公司治理中加强党的领导的意见》, http://www.gov.cn/zhengce/2021-05/30/content_5614000.htm, 2021-05-30)] \ No newline at end of file diff --git a/packages/grappler/grappler.cabal b/packages/grappler/grappler.cabal new file mode 100644 index 0000000..ae06ea7 --- /dev/null +++ b/packages/grappler/grappler.cabal @@ -0,0 +1,71 @@ +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.34.4. +-- +-- see: https://github.com/sol/hpack + +name: grappler +version: 0.0.1.0 +description: See README at +category: Mobius, Service +homepage: https://github.com/kongxiangyan/insights-grappler#readme +bug-reports: https://github.com/kongxiangyan/insights-grappler/issues +author: Cigaret +maintainer: kcigaret@outlook.com +copyright: 2021 Cigaret +license: GPL-3.0 +license-file: LICENSE +build-type: Simple +tested-with: + GHC == 8.10.4 +extra-source-files: + CHANGELOG.md + README.md + +source-repository head + type: git + location: https://github.com/kongxiangyan/insights-grappler + +library + exposed-modules: + Lib + other-modules: + Paths_grappler + hs-source-dirs: + lib + ghc-options: -Wall + build-depends: + base >=4.7 && <5 + default-language: Haskell2010 + +executable grappler-exe + main-is: Main.hs + other-modules: + Gov.Taiyuan + Gov.Top + Paths_grappler + hs-source-dirs: + app + ghc-options: -Wall + build-depends: + base >=4.7 && <5 + , grappler + , http-client + , http-conduit + , http-types + , tagsoup + , utf8-string + default-language: Haskell2010 + +test-suite grappler-test + type: exitcode-stdio-1.0 + main-is: Spec.hs + other-modules: + Paths_grappler + hs-source-dirs: + test + ghc-options: -Wall + build-depends: + base >=4.7 && <5 + , grappler + default-language: Haskell2010 diff --git a/packages/grappler/lib/Lib.hs b/packages/grappler/lib/Lib.hs new file mode 100644 index 0000000..47e0315 --- /dev/null +++ b/packages/grappler/lib/Lib.hs @@ -0,0 +1,7 @@ +module Lib + ( someFunc + ) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" + \ No newline at end of file diff --git a/packages/grappler/package.yaml b/packages/grappler/package.yaml new file mode 100644 index 0000000..b8ebb37 --- /dev/null +++ b/packages/grappler/package.yaml @@ -0,0 +1,73 @@ +# @refer: https://github.com/sol/hpack + +# spec-version: +name: grappler +version: 0.0.1.0 +# synopsis: Short description of your package +description: See README at +category: Mobius, Service +# stability: Stable +homepage: https://github.com/kongxiangyan/insights-grappler#readme +bug-reports: https://github.com/kongxiangyan/insights-grappler/issues +author: + - Cigaret +maintainer: kcigaret@outlook.com +copyright: 2021 Cigaret +license: GPL-3.0 +license-file: LICENSE + +tested-with: GHC == 8.10.4 +build-type: Simple + +extra-source-files: + - CHANGELOG.md + - README.md +# extra-doc-files: [] +# data-files: [] +# data-dir: + +github: kongxiangyan/insights-grappler +# git: + +# custom-setup: {} +# flags: {} + +ghc-options: -Wall + +library: + source-dirs: lib + ghc-options: [] +# exposed: +# visibility: +# exposed-modules: [] +# generated-exposed-modules: [] +# other-modules: [] +# generated-other-modules: [] +# reexported-modules: [] +# signature: + +dependencies: + - base >= 4.7 && < 5 + +executables: + grappler-exe: + main: Main.hs + source-dirs: app + ghc-options: [] +# other-modules: +# generated-other-modules: + dependencies: + - grappler + - http-client + - http-conduit + - http-types + - utf8-string + - tagsoup + +tests: + grappler-test: + main: Spec.hs + source-dirs: test + ghc-options: [] + dependencies: + - grappler diff --git a/packages/grappler/test/Spec.hs b/packages/grappler/test/Spec.hs new file mode 100644 index 0000000..5a96cfb --- /dev/null +++ b/packages/grappler/test/Spec.hs @@ -0,0 +1,3 @@ +main :: IO () +main = putStrLn "Test suite not yet implemented" + \ No newline at end of file diff --git a/stack.yaml b/stack.yaml index 89fd584..9a6d1c5 100644 --- a/stack.yaml +++ b/stack.yaml @@ -3,8 +3,12 @@ drop-packages: [] user-message: "" -packages: [] +packages: [ + "./packages/grappler" +] extra-deps: [] flags: {} -ghc-options: {} +ghc-options: { + "$everything": -haddock +}