I hereby claim:
- I am robkuz on github.
- I am robkuz (https://keybase.io/robkuz) on keybase.
- I have a public key ASAMZndFj-jdg8qESBMKO7DN7lBUZd4guVtM26w_4WkAdwo
To claim this, I am signing this object:
| am hitting the following error while installing `@nestjs/schedule` | |
| ``` | |
| ❯ npm i --verbose | |
| npm verb cli /opt/homebrew/Cellar/node/21.6.1/bin/node /opt/homebrew/bin/npm | |
| npm info using npm@10.2.4 | |
| npm info using node@v21.6.1 | |
| npm verb title npm i | |
| npm verb argv "i" "--loglevel" "verbose" |
| //I find typescripts enums a bit lacking. | |
| //This is a way to havevery strongly typed bidirectional lookup table | |
| //first we start with a helper type to reverse a record with unique literal value types as property types | |
| type UniqueReverser<T extends Record<keyof T, PropertyKey>> = unknown extends { | |
| [K in keyof T]-?: T[K] extends Omit<T, K>[Exclude<keyof T, K>] ? unknown : never | |
| }[keyof T] ? never : { [P in keyof T as T[P]]: P } | |
| //this will allow to convert an object in this shape and type | |
| const SOURCE = { |
I hereby claim:
To claim this, I am signing this object:
| open System | |
| open Newtonsoft.Json.Linq | |
| module JsonTest = | |
| let tokenType2String tt = | |
| match tt with | |
| | JTokenType.None -> "None" | |
| | JTokenType.Object -> "Object" | |
| | JTokenType.Array -> "Array" | |
| | JTokenType.Constructor -> "Constructor" |
| Given the following definitions | |
| |>> : map/fmap | |
| v: NonEmptyList<SomeRecord> | |
| SomeRecord: {foo: Option<_>; bar: Option<_>; baz: Option<_>} | |
| isSomeList: SomeRecord -> List<bool, string> | |
| //string: the name of the field | |
| //bool: if Some then true else false | |
| What does this code do? |
| //I'd like to see if the test below is true on different execution environments and compilers | |
| //so if you could please run this code and report back to me at @kuzrob. Thanks | |
| open Microsoft.FSharp.Reflection | |
| type SomeDU<'a,'b, 'c> = | |
| | One of 'a | |
| | Two of 'a * 'b | |
| | Three of 'a * 'b * 'c |
| type FooProtocol = | |
| abstract member foo: unit -> string | |
| type Foo = Foo of string with | |
| interface FooProtocol with | |
| member this.foo () = "foo" | |
| let bar (foo: FooProtocol, _) = () | |
| let barnested ((foo: FooProtocol, _), y) = () | |
| let barnestedrev (y, (foo: FooProtocol, _)) = () |
Here is someway to support method overloading with F# and to create a bind function.
first create an inline operator
let inline (>>=) (f: ^U -> ^T) (t:^T) =
let bind' = (^T : (member bind : (^U -> ^T) -> ^T) (t, f))
bind'| initial code with some really convoluted error handling. | |
| The problem on this is that it must check for 2 different error cases and also return a different result in those error cases | |
| dot :: Matrix -> Matrix -> Either MatrixError Number | |
| dot (Matrix a sa) (Matrix b sb) = if areSimilarVectors sa sb then Right $ dot' a b else failed sa sb | |
| where | |
| areSimilarVectors s1 s2 = isVector s1 s2 && isSameSize s1 s2 | |
| dot' a b = _dot (join a) (join b) | |
| isVector sa sb = fst sa == 1 && fst sb == 1 | |
| isSameSize sa sb = snd sa == snd sb |
I am wrapping some matrix library from javascript into Purescript. And I am thinking which signatures my two creation functions for a matrix should have. Their main difference is that in one case you just give a Vector (JS Array) and in the other case you give a 2D Array. In the first case I can easily construct my Matrix. But in the second case I have a error condition to check as the array elemements of of the 2D array (themselves being arrays) all need to be of the same lenght.
data Matrix = Matrix (Array (Array Number))
data Err = Err -- just some error, really not import what kind
make :: (Array (Array Number)) -> Either Err Matrix