7 questions from the last 7 days
3
votes
1
answer
89
views
I can't derive the type of fmap . const
While studying Haskell, I learned that <$ is defined as (<$) = fmap . const. I wanted to understand this by deriving its type and behavior from fmap, const, and (.).
However, no matter how much ...
3
votes
3
answers
130
views
How to store std::complex operator as a variable (C++)
I've been writing some tests for the arithmetic of complex numbers.
I've tried to write them in a way where I don't have to rewrite a code section for each operator. I am trying to store std::complex ...
5
votes
2
answers
97
views
Trying to make bounded floating point types in rust, problem with From and Into
Here is the code, I'm trying to make bounded floating point numbers.
I do this with a Bounds trait, that must be implemented for the generic type B in the Bounded number struct.
I would like to be ...
1
vote
1
answer
38
views
How to convert a FloatingPoint-conforming value to a CGFloat?
I'm writing a View that receives some data, and I'd like it to be generic over what kind of floating point-number that data uses.
typealias DataKey = StringProtocol & Sendable
typealias DataValue =...
0
votes
1
answer
57
views
Get Superclass type of TypeScript class?
Given
class Foo {
x = 1;
y = 2;
}
class Bar extends Foo {
override x = 11;
z = 3;
}
Is it possible to derive Foo given Bar automatically? Like Superclass<Bar> === Foo ?
0
votes
1
answer
62
views
Type casting from type 'Type' in dart
I have a Flutter widget that looks like this:
class KeyboardShortcuts extends ConsumerWidget {
final Widget child;
const KeyboardShortcuts({super.key, required this.child});
@override
Widget ...
0
votes
0
answers
2
views
Python: how to use typeguard for numpy structured arrays?
I want to implement functions that act on specific numpy structured arrays, but typeguard doesn't seem to work properly:
import numpy as np
from typeguard import typechecked
mytype2 = np.dtype([(&...