Stylish haskell

This commit is contained in:
Mats Rauhala 2019-10-15 23:12:33 +03:00
parent 10d767157c
commit e347b4753b
3 changed files with 8 additions and 9 deletions

View File

@ -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

View File

@ -9,8 +9,8 @@ import Servant
import Servant.Server.Generic
import API (handler)
import Solidabis.API (HasClientEnv, HasToken)
import Data.Language (HasModel)
import Solidabis.API (HasClientEnv, HasToken)
newtype Port = Port Int deriving (Show, FromJSON)