<commit_before>implementation module IRC

import StdList
import GenPrint
import StdOverloaded
import Data.Maybe
import Data.Either
import StdFunc
import StdString
from Text import class Text(..), instance Text String
from StdMisc import undef

derive gPrint IRCCommands, IRCReplies, IRCErrors, (,), Maybe, (), Either

instance toString IRCCommands where
	toString r = flip (+++) "\r\n" case r of
	//ADMIN (Maybe String)
	//AWAY String
	//CONNECT String Int (Maybe String)
	//DIE 
	//ERROR String
	//INFO (Maybe String)
	//INVITE String String
	//ISON [String]
		JOIN chs = "JOIN " +++ (if (isEmpty chs) "0"
			(join ", " [join " " [ch:maybeToList mk]\\(ch, mk)<-chs]))
	//KICK String String (Maybe String)
	//KILL String String
	//LINKS (Maybe (Maybe String, String))
	//LIST [String]
	//LUSERS (Maybe (String, Maybe String))
	//MODE String
	//MOTD (Maybe String)
	//NAMES [String]
		NICK n = join " " ["NICK", n]
	//NJOIN 
	//NOTICE String String
	//OPER String String 
	//PART [String]
	//PASS String
	//PING [String]
	//PONG [String]
		PRIVMSG dest msg = join " " ["PRIVMSG", dest, msg]
		QUIT msg = join " " ["QUIT":maybeToList msg]
	//REHASH 
	//RESTART 
	//SERVER 
	//SERVICE String String String String
	//SERVLIST (Maybe (String, Maybe String))
	//SQUERY String String
	//SQUIRT 
	//SQUIT String String
	//STATS (Maybe (String, Maybe String))
	//SUMMON String (Maybe (String, Maybe String))
	//TIME (Maybe String)
	//TOPIC String (Maybe String)
	//TRACE (Maybe String)
		USER login mode rn = join " " ["USER", login, toString mode, "*", ":", rn]
	//USERHOST [String]
	//USERS (Maybe String)
	//VERSION (Maybe String)
	//WALLOPS String
	//WHO (Maybe String)
	//WHOIS (Maybe String) [String]
	//WHOWAS (Maybe String) [String]
		_ = printToString r


instance toString IRCReplies where toString r = printToString r
instance toString IRCErrors where toString r = printToString r
<commit_msg>fix problem with : for longer strings<commit_after>implementation module IRC

import StdList
import GenPrint
import StdOverloaded
import Data.Maybe
import Data.Either
import StdFunc
import StdString
from Text import class Text(..), instance Text String
from StdMisc import undef

derive gPrint IRCCommands, IRCReplies, IRCErrors, (,), Maybe, (), Either

instance toString IRCCommands where
	toString r = flip (+++) "\r\n" case r of
	//ADMIN (Maybe String)
	//AWAY String
	//CONNECT String Int (Maybe String)
	//DIE 
	//ERROR String
	//INFO (Maybe String)
	//INVITE String String
	//ISON [String]
		JOIN chs = "JOIN " +++ (if (isEmpty chs) "0"
			(join ", " [join " " [ch:maybeToList mk]\\(ch, mk)<-chs]))
	//KICK String String (Maybe String)
	//KILL String String
	//LINKS (Maybe (Maybe String, String))
	//LIST [String]
	//LUSERS (Maybe (String, Maybe String))
	//MODE String
	//MOTD (Maybe String)
	//NAMES [String]
		NICK n = join " " ["NICK", n]
	//NJOIN 
	//NOTICE String String
	//OPER String String 
	//PART [String]
	//PASS String
	//PING [String]
	//PONG [String]
		PRIVMSG dest msg = join " " ["PRIVMSG", dest, ":"+++msg]
		QUIT msg = join " " ["QUIT":maybeToList msg]
	//REHASH 
	//RESTART 
	//SERVER 
	//SERVICE String String String String
	//SERVLIST (Maybe (String, Maybe String))
	//SQUERY String String
	//SQUIRT 
	//SQUIT String String
	//STATS (Maybe (String, Maybe String))
	//SUMMON String (Maybe (String, Maybe String))
	//TIME (Maybe String)
	//TOPIC String (Maybe String)
	//TRACE (Maybe String)
		USER login mode rn = join " " ["USER", login, toString mode, "*", ":"+++rn]
	//USERHOST [String]
	//USERS (Maybe String)
	//VERSION (Maybe String)
	//WALLOPS String
	//WHO (Maybe String)
	//WHOIS (Maybe String) [String]
	//WHOWAS (Maybe String) [String]
		_ = printToString r


instance toString IRCReplies where toString r = printToString r
instance toString IRCErrors where toString r = printToString r

{'fraction_non_alphanumeric': 0.1400157026956294, 'fraction_numerical': 0.0005234231876472127, 'mean_word_length': 3.4754098360655736, 'pattern_counts': {'":': 5, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3148024', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1299, 'n_words': 463}