gt-tools 0.1 → 0.1.1
raw patch · 6 files changed
+30/−24 lines, 6 files
Files
- Gt/Core.hs +0/−1
- Gt/Helpers.hs +15/−1
- Gt/Net.hs +5/−3
- Gtc/gtc.hs +1/−1
- Gtg/gtg.hs +1/−9
- gt-tools.cabal +8/−9
Gt/Core.hs view
@@ -10,7 +10,6 @@ import Gt.Helpers import Gt.Translation -import Data.List import Text.JSON do_trans :: Lang -> Lang -> String -> IO String
Gt/Helpers.hs view
@@ -1,21 +1,35 @@ module Gt.Helpers (- nub_sort+ decodeString , from_ok , jarr_to_list , jstr_to_str , jlist_to_slist+ , nub_sort , shift_lines ) where +import Data.Char+import Data.Word+ import Text.JSON +import qualified Codec.Binary.UTF8.String as U (decode) import qualified Data.Set as S +-- UTF-8 decode helpers+stringToBytes :: String -> [Word8]+stringToBytes = map (toEnum . ord)++decodeString :: String -> String+decodeString = U.decode . stringToBytes++ -- nub + sort through Set nub_sort :: Ord a => [a] -> [a] nub_sort = S.toList . S.fromList+ -- shifts lines for 4 spaces for n times shift_lines :: Int -> String -> String
Gt/Net.hs view
@@ -5,12 +5,14 @@ ) where -import Gt.Langs import Data.Maybe++import Gt.Helpers (decodeString)+import Gt.Langs+ import Network.URL import Network.HTTP - trans_url :: Lang -> Lang -> String -> String trans_url sl tl text = exportURL $ foldl add_param base_url [("text", text), ("sl", sl), ("tl", tl)]@@ -19,7 +21,7 @@ get_resp :: Lang -> Lang -> String -> IO String get_resp sl tl str = do result <- simpleHTTP (getRequest $ trans_url sl tl str) >>= getResponseBody- return result+ return $ decodeString $ result get_resp_each_word :: Lang -> Lang -> String -> IO String get_resp_each_word = undefined
Gtc/gtc.hs view
@@ -4,7 +4,7 @@ ) where import Gt.Core-import Data.List+import Data.List (intercalate) import System.Exit import qualified System.Environment.UTF8 as U
Gtg/gtg.hs view
@@ -4,19 +4,11 @@ ) where import Gt.Core-import Data.Word-import Data.Char+import Gt.Helpers (decodeString) import Gt.Langs import Graphics.UI.Gtk import Graphics.UI.Gtk.Glade-import Codec.Binary.UTF8.String (decode) import Paths_gt_tools(getDataDir)--stringToBytes :: String -> [Word8]-stringToBytes = map (toEnum . ord)--decodeString :: String -> String-decodeString = decode . stringToBytes main :: IO() main = do
gt-tools.cabal view
@@ -1,5 +1,5 @@ name: gt-tools-version: 0.1+version: 0.1.1 cabal-version: >= 1.8 build-type: Simple license: GPL@@ -16,7 +16,7 @@ category: Tools author: Mikhail S. Pobolovets stability: experimental-tested-with: GHC==6.10.4+tested-with: GHC==6.12.1 data-files: LICENSE README Gtg/main.glade data-dir: "" extra-source-files: Setup.lhs@@ -42,17 +42,14 @@ executable gtg main-is: gtg.hs-- if flag(gui)- buildable: True- else- buildable: False- ghc-options: -Wall include-dirs: . hs-source-dirs: ., Gt, Gtg other-modules: Gt.Core, Gt.Helpers, Gt.Langs, Gt.Net, Gt.Translation- build-depends:++ if flag(gui)+ buildable: True+ build-depends: base >= 4 && < 5, containers, HTTP,@@ -61,3 +58,5 @@ gtk, glade, utf8-string+ else+ buildable: False