{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ViewPatterns #-}
module Dovetail.Core.Data.Semigroup where
import Data.Foldable (fold)
import Data.Text (Text)
import Data.Vector (Vector)
import Dovetail
import Dovetail.Evaluate (builtIn)
env :: forall ctx. Env ctx
env :: Env ctx
env = do
let _ModuleName :: ModuleName
_ModuleName = Text -> ModuleName
ModuleName Text
"Data.Semigroup"
[Env ctx] -> Env ctx
forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold
[
ModuleName -> Text -> (Text -> Text -> Eval ctx Text) -> Env ctx
forall ctx a. ToValue ctx a => ModuleName -> Text -> a -> Env ctx
builtIn @ctx @(Text -> Text -> Eval ctx Text)
ModuleName
_ModuleName Text
"concatString"
\Text
xs Text
ys ->
Text -> Eval ctx Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text
xs Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
ys)
, ModuleName
-> Text
-> (Vector (Value ctx)
-> Vector (Value ctx) -> Eval ctx (Vector (Value ctx)))
-> Env ctx
forall ctx a. ToValue ctx a => ModuleName -> Text -> a -> Env ctx
builtIn @ctx @(Vector (Value ctx) -> Vector (Value ctx) -> Eval ctx (Vector (Value ctx)))
ModuleName
_ModuleName Text
"concatArray"
\Vector (Value ctx)
xs Vector (Value ctx)
ys ->
Vector (Value ctx) -> Eval ctx (Vector (Value ctx))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector (Value ctx)
xs Vector (Value ctx) -> Vector (Value ctx) -> Vector (Value ctx)
forall a. Semigroup a => a -> a -> a
<> Vector (Value ctx)
ys)
]