Last active
December 18, 2015 04:59
Revisions
-
h-hirai revised this gist
Jun 7, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,4 +15,8 @@ makePrisms ''Hoge True *Main> has _A (B False) False *Main> (E "hoge") ^? _A Nothing *Main> (E "hoge") ^? _E Just "hoge" -} -
h-hirai created this gist
Jun 7, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ {-# LANGUAGE TemplateHaskell #-} import Control.Lens data Hoge = A Int | B Bool | C Char | D | E String deriving Show makePrisms ''Hoge {- *Main> has _A (A 3) True *Main> has _A (B False) False -}