Last active
          April 11, 2018 07:37 
        
      - 
      
- 
        Save afsalthaj/15663f83cbaadd9e56c83501be635767 to your computer and use it in GitHub Desktop. 
  
    
      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
    
  
  
    
  | import scalaz.syntax.std.option._ | |
| import scalaz.{@@, Show, Tag} | |
| import scalaz.syntax.show._ | |
| trait Tagger[A] { | |
| sealed trait Marker | |
| final type Type = A @@ Marker | |
| def apply(a: A): Type = Tag[A, Marker](a) | |
| def unapply(tagged: Type): Option[A] = unwrapped(tagged).some | |
| def unwrapped(tagged: Type): A = Tag.unwrap(tagged) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment