Skip to content

Commit

Permalink
Adjust module structure
Browse files Browse the repository at this point in the history
  • Loading branch information
solomon-b committed Dec 5, 2022
1 parent 8240e18 commit 310a0dd
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 130 deletions.
20 changes: 10 additions & 10 deletions chat-bots-contrib/chat-bots-contrib.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ library

hs-source-dirs: src
exposed-modules:
CofreeBot.Bot.Calculator
CofreeBot.Bot.Calculator.Language
CofreeBot.Bot.CoinFlip
CofreeBot.Bot.GHCI
CofreeBot.Bot.Hello
CofreeBot.Bot.Jitsi
CofreeBot.Bot.Jitsi.Dictionary
CofreeBot.Bot.Magic8Ball
CofreeBot.Bot.Updog
CofreeBot.Server.Matrix
Data.Chat.Bot.Calculator
Data.Chat.Bot.Calculator.Language
Data.Chat.Bot.CoinFlip
Data.Chat.Bot.GHCI
Data.Chat.Bot.Hello
Data.Chat.Bot.Jitsi
Data.Chat.Bot.Jitsi.Dictionary
Data.Chat.Bot.Magic8Ball
Data.Chat.Bot.Updog
Data.Chat.Server.Matrix

build-depends:
, aeson
Expand Down
32 changes: 0 additions & 32 deletions chat-bots-contrib/src/CofreeBot.hs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CofreeBot.Bot.Calculator
module Data.Chat.Bot.Calculator
( calculatorBot,
simplifyCalculatorBot,
printCalcOutput,
Expand All @@ -8,12 +8,12 @@ where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import CofreeBot.Bot.Calculator.Language as Language
import CofreeBot.Bot.Monoidal
import CofreeBot.Utils
import Control.Monad.Reader
import Control.Monad.State
import Data.Chat.Bot
import Data.Chat.Bot.Calculator.Language as Language
import Data.Chat.Bot.Monoidal
import Data.Chat.Utils
import Data.Profunctor
import Data.Text (Text)
import Data.Text qualified as Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
{-# OPTIONS -fdefer-typed-holes -Wno-orphans #-}
{-# LANGUAGE RankNTypes #-}

module CofreeBot.Bot.Calculator.Language where
module Data.Chat.Bot.Calculator.Language where

import CofreeBot.Utils
import Control.Applicative
import Control.Monad.Error.Class
import Control.Monad.Except
Expand All @@ -16,6 +15,7 @@ import Data.Char
( isAlpha,
isDigit,
)
import Data.Chat.Utils
#if MIN_VERSION_GLASGOW_HASKELL(9,0,2,0)
#else
import Data.Foldable (asum)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module CofreeBot.Bot.CoinFlip where
module Data.Chat.Bot.CoinFlip where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import Control.Monad.ListT (emptyListT)
import Control.Monad.Reader
import Data.Attoparsec.Text
import Data.Bifunctor (bimap)
import Data.Chat.Bot
import Data.Profunctor
import Data.Text (Text)
import Data.Text qualified as Text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE NumDecimals #-}

module CofreeBot.Bot.GHCI
module Data.Chat.Bot.GHCI
( ghciBot,
ghciConfig,
hGetOutput,
Expand All @@ -9,13 +9,13 @@ where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import CofreeBot.Bot.Monoidal
import CofreeBot.Utils
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Loops (whileM)
import Data.Attoparsec.Text as A
import Data.Chat.Bot
import Data.Chat.Bot.Monoidal
import Data.Chat.Utils
import Data.Profunctor
import Data.Text (Text)
import Data.Text qualified as Text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
-- | The Simplest Bot. This module serves as an introductory example
-- for bot construction.
module CofreeBot.Bot.Hello
module Data.Chat.Bot.Hello
( helloSimpleBot,
helloMatrixBot,
)
where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import CofreeBot.Server.Matrix
import Control.Monad.ListT (emptyListT)
import Data.Chat.Bot
import Data.Chat.Server.Matrix
import Data.Text (Text)
import Data.Text qualified as Text

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module CofreeBot.Bot.Jitsi
module Data.Chat.Bot.Jitsi
( jitsiBot,
)
where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import CofreeBot.Bot.Jitsi.Dictionary
import CofreeBot.Bot.Monoidal
import CofreeBot.Utils (indistinct)
import Data.Chat.Bot
import Data.Chat.Bot.Jitsi.Dictionary
import Data.Chat.Bot.Monoidal
import Data.Chat.Utils (indistinct)
import Data.Profunctor
import Data.Text (Text)
import Data.Vector qualified as V
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedLists #-}

module CofreeBot.Bot.Jitsi.Dictionary where
module Data.Chat.Bot.Jitsi.Dictionary where

import Data.Text (Text)
import Data.Vector (Vector)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module CofreeBot.Bot.Magic8Ball
module Data.Chat.Bot.Magic8Ball
( magic8BallBot,
simplifyMagic8BallBot,
)
where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import Control.Monad.ListT (emptyListT)
import Control.Monad.Reader
import Data.Attoparsec.Text
import Data.Bifunctor (bimap)
import Data.Chat.Bot
import Data.Profunctor
import Data.Text (Text)
import Data.Text qualified as Text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module CofreeBot.Bot.Updog
module Data.Chat.Bot.Updog
( updogSimpleBot,
updogMatrixBot,
)
where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import CofreeBot.Server.Matrix
import Control.Applicative
( empty,
liftA2,
)
import Control.Monad.ListT (toListT)
import Data.Chat.Bot
import Data.Chat.Server.Matrix
import Data.String
import Data.Text (Text)
import Data.Text qualified as T
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CofreeBot.Server.Matrix
module Data.Chat.Server.Matrix
( -- * Matrix Bot
MatrixBot,
matrix,
Expand All @@ -11,11 +11,11 @@ where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import CofreeBot.Server
import CofreeBot.Utils (readFileMaybe)
import Control.Lens
import Control.Monad.Except
import Data.Chat.Bot
import Data.Chat.Server
import Data.Chat.Utils (readFileMaybe)
import Data.Map.Strict qualified as Map
import Data.Text (Text)
import Data.Text qualified as Text
Expand Down
14 changes: 7 additions & 7 deletions chat-bots-contrib/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ module Main where

--------------------------------------------------------------------------------

import CofreeBot
( fixBot,
sessionize,
simplifySessionBot,
)
import CofreeBot.Bot.Calculator
import Data.Chat.Bot (fixBot)
import Data.Chat.Bot.Calculator
( calculatorBot,
printCalcOutput,
simplifyCalculatorBot,
statementP,
)
import CofreeBot.Bot.Hello (helloSimpleBot)
import Data.Chat.Bot.Context
( sessionize,
simplifySessionBot,
)
import Data.Chat.Bot.Hello (helloSimpleBot)
import Scripts (mkScript)
import Test.Hspec (Spec, describe, hspec, it, shouldBe)
import TestServer (runTestScript)
Expand Down
10 changes: 5 additions & 5 deletions chat-bots-contrib/test/TestServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ where

--------------------------------------------------------------------------------

import CofreeBot.Bot
( Behavior (Behavior),
liftBehavior,
)
import CofreeBot.Server (Server (..), loop)
import Control.Monad.Except
( ExceptT,
MonadError (..),
Expand All @@ -23,6 +18,11 @@ import Control.Monad.State
gets,
modify,
)
import Data.Chat.Bot
( Behavior (Behavior),
liftBehavior,
)
import Data.Chat.Server (Server (..), loop)
import Data.Fix (Fix (..))
import Data.Text (Text)
import Scripts
Expand Down
13 changes: 6 additions & 7 deletions chat-bots/chat-bots.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ library

hs-source-dirs: src
exposed-modules:
CofreeBot
CofreeBot.Bot
CofreeBot.Bot.Monoidal
CofreeBot.Bot.Context
CofreeBot.Server
CofreeBot.Server.Repl
CofreeBot.Utils
Data.Chat.Bot
Data.Chat.Bot.Monoidal
Data.Chat.Bot.Context
Data.Chat.Server
Data.Chat.Server.Repl
Data.Chat.Utils
Control.Monad.ListT
Parsing

Expand Down
16 changes: 0 additions & 16 deletions chat-bots/src/CofreeBot.hs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ViewPatterns #-}

module CofreeBot.Bot
module Data.Chat.Bot
( -- * Bot
Bot (..),
KBot,
Expand All @@ -27,13 +27,13 @@ where

--------------------------------------------------------------------------------

import CofreeBot.Utils (readFileMaybe)
import Control.Arrow qualified as Arrow
import Control.Monad.Except
import Control.Monad.ListT
import Control.Monad.Reader
import Control.Monad.State
import Data.Bifunctor (Bifunctor (..))
import Data.Chat.Utils (readFileMaybe)
import Data.Foldable (asum)
import Data.Functor ((<&>))
import Data.Kind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{-# HLINT ignore "Use <$>" #-}

-- | Context Transformations for bots
module CofreeBot.Bot.Context
module Data.Chat.Bot.Context
( -- * Room Awareness
RoomAware,
mkRoomAware,
Expand All @@ -24,12 +24,12 @@ where

--------------------------------------------------------------------------------

import CofreeBot.Bot
import Control.Applicative
import Control.Arrow qualified as Arrow
import Control.Monad.ListT (emptyListT)
import Data.Attoparsec.Text
import Data.Bifunctor (Bifunctor (first))
import Data.Chat.Bot
import Data.IntMap.Strict (IntMap)
import Data.IntMap.Strict qualified as IntMap
import Data.Profunctor (second')
Expand Down
Loading

0 comments on commit 310a0dd

Please sign in to comment.