Skip to content

Instantly share code, notes, and snippets.

@oisdk
Created May 8, 2019 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oisdk/4b7f304c9a9273b07f227f63fd896231 to your computer and use it in GitHub Desktop.
Save oisdk/4b7f304c9a9273b07f227f63fd896231 to your computer and use it in GitHub Desktop.
isPal :: forall a. Eq a => [a] -> Bool
isPal xs = getAll (fst (go xs xs)) where
go (y:ys) (_:_:zs) = f y =<< go ys zs
go (_:ys) [_] = pure ys
go ys [] = pure ys
f y ~(z:zs) = (All (y == z), zs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment