Add Haskell Palindrome (#120)

pull/122/head
Gauravsingh Sisodia 2021-03-27 22:49:27 +05:30 committed by GitHub
parent 89b7afb0cf
commit 098eed7b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -32,3 +32,7 @@
1. [Palindrome Check](rust/palindrome/README.md) 1. [Palindrome Check](rust/palindrome/README.md)
### Haskell
1. [Palin Check](haskell/palindrome.hs)

View File

@ -0,0 +1,10 @@
import Control.Monad (ap)
isPalindrome :: String -> Bool
isPalindrome s = s == reverse s
-- point-free style
isPalindrome2 :: String -> Bool
isPalindrome2 = ap (==) reverse
main = traverse print $ isPalindrome <$> ["abba", "abbcccbba", "abbccbbba"]