Created
January 14, 2016 19:07
-
-
Save wangbj/0bcf8a821753828a1ece to your computer and use it in GitHub Desktop.
GHC ViewPatterns.
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 ViewPatterns #-} | |
import qualified Data.Sequence as Seq | |
import Data.Sequence(Seq) | |
lastr :: Seq a -> Maybe a | |
lastr (Seq.viewr -> Seq.EmptyR) = Nothing | |
lastr (Seq.viewr -> s Seq.:> x) = Just x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment