Hi,

A sample from [here](https://nim-lang.org/docs/manual.html#generics-concepts) 
doesn't work:
    
    
    import future, typetraits
    
    type
      Functor[A] = concept f
        type MatchedGenericType = genericHead(f.type)
          # `f` will be a value of a type such as `Option[T]`
          # `MatchedGenericType` will become the `Option` type
        
        f.val is A
          # The Functor should provide a way to obtain
          # a value stored inside it
        
        type T = auto
        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
    

output:
    
    
    $ nim c -r main.nim
    Hint: used config file '/etc/nim.cfg' [Conf]
    Hint: system [Processing]
    Hint: main [Processing]
    Hint: future [Processing]
    Hint: macros [Processing]
    Hint: typetraits [Processing]
    Hint: options [Processing]
    main.nim(4, 3) Hint: 'A' is declared but not used [XDeclaredButNotUsed]
    Hint:  [Link]
    Hint: operation successful (12703 lines compiled; 0.199 sec total; 
22.422MiB peakmem; Debug Build) [SuccessX]
    Hint: /home/trtt/Projects/tests/main  [Exec]
    false
    

Reply via email to