All Projects → haskell-text → text-display

haskell-text / text-display

Licence: MIT license
A Typeclass for user-facing output

Programming Languages

haskell
3896 projects
Makefile
30231 projects
Nix
1067 projects
shell
77523 projects

Projects that are alternatives of or similar to text-display

Volvo-melbus
Volvo MELBUS Bluetooth audio input and remote control with Arduino Nano
Stars: ✭ 51 (+13.33%)
Mutual labels:  text, display
vue-responsive-text
↔ Vue component that scales its child node in relation to its parent node's width
Stars: ✭ 23 (-48.89%)
Mutual labels:  text
instagram-text-editor
An Instagram like text editor Flutter widget that helps you to change your text style.
Stars: ✭ 66 (+46.67%)
Mutual labels:  text
privacy-policy-template
Privacy Policy Template for website or app
Stars: ✭ 64 (+42.22%)
Mutual labels:  text
rake new2
A Python library that enables smooth keyword extraction from any text using the RAKE(Rapid Automatic Keyword Extraction) algorithm.
Stars: ✭ 23 (-48.89%)
Mutual labels:  text
table
Produces a string that represents slice data in a text table, inspired by gajus/table.
Stars: ✭ 130 (+188.89%)
Mutual labels:  text
link text
Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links
Stars: ✭ 20 (-55.56%)
Mutual labels:  text
vue-scrollin
🎰 Scroll-in text component for Vue
Stars: ✭ 61 (+35.56%)
Mutual labels:  text
text-editor
A text selection range API written in pure JavaScript, for modern browsers.
Stars: ✭ 24 (-46.67%)
Mutual labels:  text
text-sdk-php
PHP SDK to send messages with CM.com
Stars: ✭ 18 (-60%)
Mutual labels:  text
x11-fractional-display-scaling
Script and instructions to get fractional display scaling working nicely on Linux distros that use X11
Stars: ✭ 52 (+15.56%)
Mutual labels:  display
RubyTextMeshPro
Unity Text Mesh Proでルビ(フリガナ)のタグを追加しました.
Stars: ✭ 61 (+35.56%)
Mutual labels:  text
text-image
Convert text to image https://vincent7128.github.io/text-image/
Stars: ✭ 64 (+42.22%)
Mutual labels:  text
text-classification-baseline
Pipeline for fast building text classification TF-IDF + LogReg baselines.
Stars: ✭ 55 (+22.22%)
Mutual labels:  text
als typograf
Ruby client for ArtLebedevStudio.RemoteTypograf Web Service.
Stars: ✭ 15 (-66.67%)
Mutual labels:  text
mg
OpenBSD Mg editor. Portable Public Domain Micro Emacs for *BSD, Cygwin, Linux, Mac OS X.
Stars: ✭ 99 (+120%)
Mutual labels:  text
RAE
基于tensorflow搭建的神经网络recursive autuencode,用于实现句子聚类
Stars: ✭ 12 (-73.33%)
Mutual labels:  text
edits.cr
Edit distance algorithms inc. Jaro, Damerau-Levenshtein, and Optimal Alignment
Stars: ✭ 16 (-64.44%)
Mutual labels:  text
open-display-transform
Open Display Transform is a collection of tools and experiments for rendering wide-gamut scene-linear data into an image for an SDR or HDR display device.
Stars: ✭ 120 (+166.67%)
Mutual labels:  display
classy
Super simple text classifier using Naive Bayes. Plug-and-play, no dependencies
Stars: ✭ 12 (-73.33%)
Mutual labels:  text

CI badge made with Haskell Hackage

Buy Me a Coffee at ko-fi.com

A Typeclass for user-facing output

Description

The text-display library offers a way for developers to print a textual representation of datatypes that does not have to abide by the rules of the Show typeclass.

If you wish to learn more about how things are done and why, please read the DESIGN.md file.

Examples

There are two methods to implement Display for your type:

The first one is a manual implementation:

data ManualType = MT Int

-- >>> display (MT 32)
-- "MT 32"
instance Display ManualType where
  displayPrec prec (MT i) = displayParen (prec > 10) $ "MT " <> displayPrec 11 i

But this can be quite time-consuming, especially if your datatype already has an existing Show that you wish to reuse. In which case, you can piggy-back on this instance like this:

{-# LANGUAGE DerivingVia #-}
data AutomaticallyDerived = AD
  -- We derive 'Show'
  deriving Show 
  -- We take advantage of the 'Show' instance to derive 'Display' from it
  deriving Display
    via (ShowInstance AutomaticallyDerived) 

But let's say you want to redact an instance of Display? You can do it locally, through the OpaqueInstance helper. It is most useful to hide tokens or passwords:

data UserToken = UserToken UUID                           
 deriving Display                                         
   via (OpaqueInstance "[REDACTED]" UserToken)            
                                                          
display $ UserToken "7a01d2ce-31ff-11ec-8c10-5405db82c3cd"
-- => "[REDACTED]"                                              
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].