Commit e831e0ee authored by Mart Lubbers's avatar Mart Lubbers

Clean up imports

parent d8e24731
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]
......
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)
......
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 =
......
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
......
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
......
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)
......
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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment