<commit_before><commit_msg>Concatenation w/ hask base<commit_after>module Comparison.Concatenations where

import Control.Applicative
import Control.Category
import Melchior.Control
import Melchior.Data.String
import Melchior.Dom
import Melchior.Dom.Html
import Melchior.Dom.Selectors

main :: IO Element
main = runDom setupComparisons

setupComparisons :: [Element] -> Dom Element
setupComparisons html = do
  output <- Dom $ select (byId "hs-output" . from) html
  appendConcatenation output "String to String" (stringToString "hello " "world")
  return $ UHC.Base.head html

appendConcatenation :: Maybe Element -> String -> String -> Dom ()
appendConcatenation Nothing _ _ = return ()
appendConcatenation (Just output) s t = append output (constant $ container s t)

container :: String -> String -> Fragment
container s t = JDiv [label, result]
                where label = addClassTo "label" $ JDiv [Text $ stringToJSString s]
                      result = addClassTo "concat" $ JDiv [Text $ stringToJSString t]


stringToString :: String -> String -> String
stringToString s t = s ++ t
{'fraction_non_alphanumeric': 0.09140767824497258, 'fraction_numerical': 0.0, 'mean_word_length': 4.046082949308755, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 11, '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': '1687022', 'n_tokens_mistral': 314, 'n_tokens_neox': 307, 'n_words': 105}