Describe what you see when you walk over items
Every step the character takes, describe the entities at that position excluding the character.
This commit is contained in:
parent
4db3a68efe
commit
dd16166665
12 changed files with 82 additions and 14 deletions
15
src/Xanthous/Util/Inflection.hs
Normal file
15
src/Xanthous/Util/Inflection.hs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
module Xanthous.Util.Inflection
|
||||
( toSentence
|
||||
) where
|
||||
|
||||
import Xanthous.Prelude
|
||||
|
||||
toSentence :: (MonoFoldable mono, Element mono ~ Text) => mono -> Text
|
||||
toSentence xs = case reverse . toList $ xs of
|
||||
[] -> ""
|
||||
[x] -> x
|
||||
[b, a] -> a <> " and " <> b
|
||||
(final : butlast) ->
|
||||
intercalate ", " (reverse butlast) <> ", and " <> final
|
||||
Loading…
Add table
Add a link
Reference in a new issue