From e347b4753bb8d4f63950f60c50a7f4236ed1e3c7 Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Tue, 15 Oct 2019 23:12:33 +0300 Subject: [PATCH] Stylish haskell --- Setup.hs | 2 +- src/API.hs | 13 ++++++------- src/Server.hs | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Setup.hs b/Setup.hs index 9a994af..4467109 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,2 +1,2 @@ -import Distribution.Simple +import Distribution.Simple main = defaultMain diff --git a/src/API.hs b/src/API.hs index 5fdc94d..61be95e 100644 --- a/src/API.hs +++ b/src/API.hs @@ -9,23 +9,22 @@ module API where import Control.Monad.Reader (MonadReader, asks) import Control.Monad.Trans (MonadIO) -import Data.List (sortOn, find) +import Data.Either (partitionEithers) import Data.Foldable (traverse_) +import Data.List (find, sortOn) import Data.Text (Text) +import qualified Data.Text as T import Lucid.Base (HtmlT, ToHtml (..)) import Lucid.Html5 import Servant.API import Servant.API.Generic import Servant.HTML.Lucid import Servant.Server.Generic -import qualified Data.Text as T -import Data.Either (partitionEithers) -import Debug.Trace (traceShow) +import Data.Caesar +import Data.Language import Solidabis.API (HasClientEnv, HasToken, bullshits, getBullshits, message) -import Data.Language -import Data.Caesar data Index = Index { converted :: [Text] @@ -66,4 +65,4 @@ handler = let caesared = map (\n -> T.map (caesar n) . T.toLower $ sentence) [0..29] ranked = sortOn fst $ [(goodness model x, x) | x <- caesared] found = find (\(rank, _) -> rank > -7.9) (reverse ranked) - in ranked `traceShow` maybe (Left sentence) (Right . snd) found + in maybe (Left sentence) (Right . snd) found diff --git a/src/Server.hs b/src/Server.hs index adb5210..a7e2f19 100644 --- a/src/Server.hs +++ b/src/Server.hs @@ -9,8 +9,8 @@ import Servant import Servant.Server.Generic import API (handler) +import Data.Language (HasModel) import Solidabis.API (HasClientEnv, HasToken) -import Data.Language (HasModel) newtype Port = Port Int deriving (Show, FromJSON)