From: Mart Lubbers Date: Thu, 20 Sep 2018 07:48:52 +0000 (+0200) Subject: Clean up imports X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=e831e0ee2f4317831cf86e3d34ebb9cc15d3f845;p=cloogle-irc.git Clean up imports --- diff --git a/GenIRC.dcl b/GenIRC.dcl index 789c976..047bad2 100644 --- a/GenIRC.dcl +++ b/GenIRC.dcl @@ -1,11 +1,13 @@ definition module GenIRC import StdGeneric -from IRC import :: IRCCommand, :: CSepList + from Data.Either import :: Either from Data.Maybe import :: Maybe from Text.Parsers.Simple.Core import :: Error +from IRC import :: IRCCommand, :: CSepList + generic gIRCParse a :: [String] -> (Either Error a, [String]) generic gIRCPrint a :: a -> [String] diff --git a/GenIRC.icl b/GenIRC.icl index c813576..e6dc8ec 100644 --- a/GenIRC.icl +++ b/GenIRC.icl @@ -1,19 +1,16 @@ implementation module GenIRC -from IRC import :: IRCCommand, :: CSepList(CSepList) -from Data.Func import $ -from StdFunc import o, const - -from Text.Parsers.Simple.Core import :: Error - -import StdList -import StdString +import StdEnv import StdGeneric + import Data.Either +import Data.Func +import Data.Functor import Data.Maybe import Data.Tuple -import Data.Functor -from Text import class Text(join,split,indexOf,concat), instance Text String +import Text + +import IRC pOne [] = (Left "Expected an argument", []) pOne [a:as] = (Right a, as) diff --git a/IRC.dcl b/IRC.dcl index 862c29b..6cca24e 100644 --- a/IRC.dcl +++ b/IRC.dcl @@ -1,8 +1,9 @@ definition module IRC -from Data.Maybe import :: Maybe -from Data.Either import :: Either from StdOverloaded import class fromInt, class toInt, class toString, class fromString + +from Data.Either import :: Either +from Data.Maybe import :: Maybe from Text.Parsers.Simple.Core import :: Error :: IRCMessage = diff --git a/IRC.icl b/IRC.icl index 004a39b..39e3f50 100644 --- a/IRC.icl +++ b/IRC.icl @@ -1,29 +1,18 @@ implementation module IRC -import StdList, StdTuple, StdOverloaded, StdFunc, StdString, StdChar, StdBool -import _SystemArray - -import Text.GenPrint -import GenIRC +import StdEnv import Control.Applicative -import Control.Monad +import Control.Monad => qualified join import Data.Either +import Data.Func import Data.Maybe -import Data.Tuple +import Text +import Text.GenPrint import Text.Parsers.Simple.Chars import Text.Parsers.Simple.Core -import StdDebug - -from Data.Functor import <$> -from Data.Func import $ -from StdMisc import undef, abort -from Text import class Text(lpad,trim,rtrim,split,indexOf,concat), - instance Text String -import qualified Text - -jon :== 'Text'.join +import GenIRC derive gPrint IRCErrors, IRCReplies, Maybe, Either, IRCUser, IRCNumReply @@ -83,7 +72,7 @@ where >>= \cs->pure (toString [c:cs]) parseHost :: Parser Char String - parseHost = jon "." <$> (pSepBy parseName (pToken '.')) + parseHost = join "." <$> (pSepBy parseName (pToken '.')) >>= \s->optional (pToken '.') >>= pure o maybe s (\p->s+++toString s) where parseName :: Parser Char String @@ -97,7 +86,7 @@ parseCmd cs = fst $ gIRCParse{|*|} $ argfun $ split " " $ toString cs argfun [] = [] argfun [x:xs] # x = trim x - | x.[0] == ':' = [jon " " $ [x % (1, size x):map rtrim xs]] + | x.[0] == ':' = [join " " $ [x % (1, size x):map rtrim xs]] | otherwise = [x:argfun xs] //Reply @@ -133,7 +122,7 @@ instance toString IRCUser where toString m = m.irc_nick <+ maybe "" ((<+) "!") m.irc_user <+ maybe "" ((<+) "@") m.irc_host instance toString IRCCommand where - toString m = jon " " (gIRCPrint{|*|} m) +++ "\r\n" + toString m = join " " (gIRCPrint{|*|} m) +++ "\r\n" instance toString IRCReplies where toString r = printToString r instance toString IRCErrors where toString r = printToString r diff --git a/IRCBot.dcl b/IRCBot.dcl index 85a310e..a2542fd 100644 --- a/IRCBot.dcl +++ b/IRCBot.dcl @@ -1,8 +1,9 @@ definition module IRCBot -from IRC import :: IRCMessage -from Data.Maybe import :: Maybe from Data.Error import :: MaybeErrorString, :: MaybeError +from Data.Maybe import :: Maybe + +from IRC import :: IRCMessage /* * Spawn an IRC Bot diff --git a/IRCBot.icl b/IRCBot.icl index daed825..28f53c8 100644 --- a/IRCBot.icl +++ b/IRCBot.icl @@ -1,15 +1,15 @@ implementation module IRCBot -from Data.Func import $ +import StdEnv + import Data.Either -import Data.Error +import Data.Func import Data.Maybe -import Data.Functor import Data.Tuple -import StdTuple +import Text + import IRC -from Text import class Text(concat,split,join), instance Text String -import StdList, StdString + import TCPServer.Connection bot :: (String, Int) [IRCMessage] [IRCMessage] .a (IRCMessage -> (.a -> *(*World -> *(Maybe [IRCMessage], .a, *World)))) !*World -> *(Maybe String, .a, !*World) diff --git a/cloogleirc.icl b/cloogleirc.icl index 0150704..a8b9494 100644 --- a/cloogleirc.icl +++ b/cloogleirc.icl @@ -1,40 +1,29 @@ module cloogleirc -import Cloogle.API -import Text.GenPrint import StdEnv +import Control.Applicative +import Control.Monad => qualified join +import Data.Either +import Data.Error +import Data.Func import Data.Functor +import Data.List +import qualified Data.Map as DM import Data.Maybe -import Data.Either -from Data.Func import $, mapSt -from Text import class Text(..), instance Text String, instance + String - +import Data.Tuple import Internet.HTTP - -import Text.GenJSON - -import Text.URI +import System.CommandLine import System.Time +import Text +import Text.Encodings.UrlEncoding +import Text.GenJSON -import Control.Applicative -import qualified Control.Monad as CM -import qualified Data.Map as DM -from Control.Monad import class Monad(bind), >>= -from Text.Encodings.UrlEncoding import urlEncode -import System.CommandLine -import Internet.HTTP -import Data.Error -import Data.List -import Data.Functor -import Data.Tuple +import Cloogle.API -import TCPIP import IRC import IRCBot -import StdMisc, StdDebug - shorten :: String *World -> (String, *World) shorten s w # s = if (startsWith "http://" s) s (if (startsWith "https://" s) s ("http://" + s))