summaryrefslogtreecommitdiff
path: root/Com/Simatime/Alpha.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-07 22:07:07 -0700
committerBen Sima <ben@bsima.me>2020-04-08 20:01:25 -0700
commit751b725332fd0e9397b7cfd3f3a3bff14056c232 (patch)
tree5366cd49764aae99a4fcb7430d273f14cc4e4750 /Com/Simatime/Alpha.hs
parent8edc5c72a76ac227cac97bb39a15b194f618cc1c (diff)
Return the app state as a simple dashboard
Diffstat (limited to 'Com/Simatime/Alpha.hs')
-rw-r--r--Com/Simatime/Alpha.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Com/Simatime/Alpha.hs b/Com/Simatime/Alpha.hs
index 8f5a506..cc3d23c 100644
--- a/Com/Simatime/Alpha.hs
+++ b/Com/Simatime/Alpha.hs
@@ -11,6 +11,9 @@ module Com.Simatime.Alpha
, (/>)
, (</)
, (<//)
+ -- * Text
+ , chomp
+ , lchomp
-- * Debugging tools
, say
-- * TODO: remove this
@@ -22,6 +25,8 @@ import Data.Function ( (&) )
import Data.Functor ( (<&>) )
import Data.String
import Data.Text ( Text )
+import qualified Data.Text as Text
+import qualified Data.Text.Lazy as LazyText
import qualified Prelude
import Protolude as X
@@ -63,3 +68,11 @@ infixr 0 <|
-- functor. Could also be defined as `f >>= return . g`
(/>) :: Functor f => f a -> (a -> b) -> f b
(/>) = (<&>)
+
+-- | Removes newlines from text.
+chomp :: Text -> Text
+chomp = Text.filter (/= '\n')
+
+-- | Removes newlines from lazy text.
+lchomp :: LazyText.Text -> LazyText.Text
+lchomp = LazyText.filter (/= '\n')