Created
          November 11, 2024 13:27 
        
      - 
      
- 
        Save iagobelo/42983942eedd2a791be446675b35642b to your computer and use it in GitHub Desktop. 
    dokey
  
        
  
    
      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
    
  
  
    
  | type DonkeyBasket<V> = { | |
| value: V; | |
| }; | |
| // map | |
| // toValue | |
| // fromPredicate? | |
| // filter | |
| // attach | |
| interface DonkeyMap<A> { | |
| map: <B>(a: A) => B; | |
| } | |
| interface Donkey<A> extends DonkeyMap<A> { | |
| (value: A): string; | |
| } | |
| const donkey = <A>(value: A) => { | |
| return { | |
| map: <B>(a: A) => { | |
| if (typeof a === "number") { | |
| return a.toString(); | |
| } | |
| return a; | |
| }, | |
| toValue: () => value, | |
| }; | |
| }; | |
| // donkey(value).map(x => y).filter(x => x).attach('xablau', y); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment