Created
February 16, 2016 06:56
-
-
Save deckool/00966a91a1914f6a45c0 to your computer and use it in GitHub Desktop.
headers.hs
This file contains hidden or 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
xxx :: Snap () | |
xxx = do | |
req <- getRequest | |
let a = getHeader "user-agent" req | |
told <- maybe pass return a | |
let b = C.pack "Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune" | |
let ii = told =~ b :: Bool | |
case ii of | |
True -> writeBS "adevarat" | |
False -> writeBS "fals" | |
writeBS told |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment