Well, this version seems to work:
    
    
    import future, typetraits
    
    type
      Functor[A] = concept f
        type MatchedGenericType[T] = stripGenericParams(f.type)[T]
          # `f` will be a value of a type such as `Option[T]`
          # `MatchedGenericType` will become the `Option` type
        
        get(f) is A  # f.val is a private member of Option
          # The Functor should provide a way to obtain
          # a value stored inside it
        
        type T = typed
           # `auto` is too broad here, it includes `untyped` which does not 
match
           # the return value of a closure (argument 2 of map)
        map(f, A -> T) is MatchedGenericType[T]
          # And it should provide a way to map one instance of
          # the Functor to a instance of a different type, given
          # a suitable `map` operation for the enclosed values
    import options
    echo Option[int] is Functor # prints true
    

Reply via email to