Created
August 27, 2015 03:51
-
-
Save queertypes/ebe4e07b6528c166cafb to your computer and use it in GitHub Desktop.
Link Relations, in Haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
-- Link relations (rel), as per: http://www.iana.org/assignments/link-relations/link-relations.xhtml | |
module Link (Link(..), renderText) where | |
import Data.Text (Text) | |
data LinkRelation | |
= About | |
| Alternate | |
| Appendix | |
| Archives | |
| Author | |
| Bookmark | |
| Canonical | |
| Chapter | |
| Collection | |
| Contents | |
| CreateForm | |
| Current | |
| DerivedFrom | |
| DescribedBy | |
| Describes | |
| Disclosures | |
| DnsPrefetch | |
| Duplicate | |
| Edit | |
| EditForm | |
| EditMedia | |
| First | |
| Glossary | |
| Help | |
| Hosts | |
| Hub | |
| Icon | |
| Index | |
| Item | |
| Last | |
| LatestVersion | |
| License | |
| LRDD | |
| Memento | |
| Monitor | |
| MonitorGroup | |
| Next | |
| NextArchive | |
| NoFollow | |
| NoReferrer | |
| Original | |
| Payment | |
| Preconnect | |
| PredecessorVersion | |
| Prefetch | |
| Prerender | |
| Prev | |
| Preview | |
| Previous | |
| PrevArchive | |
| PrivacyPolicy | |
| Profile | |
| Related | |
| Replies | |
| Search | |
| Section | |
| Self | |
| Service | |
| Start | |
| Stylesheet | |
| Subsection | |
| SuccessorVersion | |
| Tag | |
| TermsOfService | |
| TimeGate | |
| TimeMap | |
| Type | |
| Up | |
| VersionHistory | |
| WorkingCopy | |
| WorkingCopyOf | |
deriving Show | |
renderText :: LinkRelation -> Text | |
renderText r = | |
case r of | |
About -> "about" | |
Alternate -> "alternate" | |
Appendix -> "appendix" | |
Archives -> "archives" | |
Author -> "author" | |
Bookmark -> "bookmark" | |
Canonical -> "canonical" | |
Chapter -> "chapter" | |
Collection -> "collection" | |
Contents -> "contents" | |
CreateForm -> "create-form" | |
Current -> "current" | |
DerivedFrom -> "derivedfrom" | |
DescribedBy -> "describedby" | |
Describes -> "describes" | |
Disclosures -> "disclosures" | |
DnsPrefetch -> "dns-prefetch" | |
Duplicate -> "duplicate" | |
Edit -> "edit" | |
EditForm -> "edit-form" | |
EditMedia -> "edit-media" | |
First -> "first" | |
Glossary -> "glossary" | |
Help -> "help" | |
Hosts -> "hosts" | |
Hub -> "hub" | |
Icon -> "icon" | |
Index -> "index" | |
Item -> "item" | |
Last -> "last" | |
LatestVersion -> "latest-version" | |
License -> "license" | |
LRDD -> "lrdd" | |
Memento -> "memento" | |
Monitor -> "monitor" | |
MonitorGroup -> "monitor-group" | |
Next -> "next" | |
NextArchive -> "next-archive" | |
NoFollow -> "nofollow" | |
NoReferrer -> "noreferrer" | |
Original -> "original" | |
Payment -> "payment" | |
Preconnect -> "preconnect" | |
PredecessorVersion -> "predecessor-version" | |
Prefetch -> "prefetch" | |
Prerender -> "prerender" | |
Prev -> "prev" | |
Preview -> "preview" | |
Previous -> "previous" | |
PrevArchive -> "prev-archive" | |
PrivacyPolicy -> "privacy-policy" | |
Profile -> "profile" | |
Related -> "related" | |
Replies -> "replies" | |
Search -> "search" | |
Section -> "section" | |
Self -> "self" | |
Service -> "service" | |
Start -> "start" | |
Stylesheet -> "stylesheet" | |
Subsection -> "subsection" | |
SuccessorVersion -> "successor-version" | |
Tag -> "tag" | |
TermsOfService -> "terms-of-service" | |
TimeGate -> "timegate" | |
TimeMap -> "timemap" | |
Type -> "type" | |
Up -> "up" | |
VersionHistory -> "version-history" | |
WorkingCopy -> "working-copy" | |
WorkingCopyOf -> "working-copy-of" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment