Skip to content

Commit

Permalink
initial cabal and fileprocessor files
Browse files Browse the repository at this point in the history
  • Loading branch information
rockkid777 committed Aug 31, 2017
1 parent f3d1bd4 commit d1a62f0
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Revision history for nameday-api

## 0.1.0.0 -- YYYY-mm-dd

* First version. Released on an unsuspecting world.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2017 Révész Ádám

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = putStrLn "Hello, Haskell!"
2 changes: 2 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
23 changes: 23 additions & 0 deletions fileProcessing.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{-# LANGUAGE OverloadedStrings #-}
import Data.List.Split ()
import qualified Data.Text as T
import System.Environment
import System.IO ()

type NameDay = ((Int, Int), [T.Text])

fromList :: [T.Text] -> NameDay
fromList str = (mkPair (take 2 (T.splitOn "." (head str))),
map T.strip (T.splitOn "," (last str)))
where
mkPair :: [T.Text] -> (Int, Int)
mkPair str' = (read $ T.unpack (head str'), read $ T.unpack (last str'))

processLine :: T.Text -> NameDay
processLine = fromList . take 2 . map T.strip . T.splitOn "\t" . T.strip

main :: IO ()
main = do
args <- getArgs
content <- readFile $ head args
mapM_ (print . processLine) $ T.lines $ T.pack content
25 changes: 25 additions & 0 deletions nameday-api.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- Initial nameday-api.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/

name: nameday-api
version: 0.1.0.0
-- synopsis:
-- description:
homepage: github.com/rockkid777/nameday-api
license: MIT
license-file: LICENSE
author: Révész Ádám
maintainer: [email protected]
-- copyright:
category: Distribution
build-type: Simple
extra-source-files: ChangeLog.md, README.md
cabal-version: >=1.10

executable nameday-api
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base >=4.9 && <4.10
-- hs-source-dirs:
default-language: Haskell2010

0 comments on commit d1a62f0

Please sign in to comment.