Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [types]

Types, and type systems, are used to enforce levels of abstraction in programs.

4,724 questions with no upvoted or accepted answers
16 votes
0 answers
420 views

Is a function that curries the first argument of a list of functions typeable in Typed Racket?

I can write a simple function in untyped Racket called curry-all that takes a list of functions, all of which accept the same kind of value for their first argument, and produces a list of functions ...
Alexis King's user avatar
  • 43.6k
11 votes
0 answers
490 views

In Idris, why do interface parameters have to be type or data constructors?

To get some practice with Idris, I've been trying to represent various basic algebraic structures as interfaces. The way I thought of organizing things at first was to make the parameters of a given ...
greatBigDot's user avatar
10 votes
0 answers
979 views

C# Pick Utility Type

In Typescript, there is a Pick Utility Type. Is it possible to do the same in C#? For example: public class SomeClassA { public string SomePropA { get; set; } public string SomePropB { get; ...
SILENT's user avatar
  • 4,180
10 votes
1 answer
401 views

Why nested types' scope does not include derived classes?

I wonder why the scope of nested types does not include derived classes in Delphi; it could make code more clean: type TBaseTest = class public type PVector = ^TVector; TVector = record ...
kludg's user avatar
  • 27.4k
8 votes
0 answers
273 views

In std::ssize, why return the common_type of decltype(c.size()) and ptrdiff_t?

I wanted a signed type corresponding to std::size (ideally computed from it rather than relying on another definition that could be independent.) Naturally I thought to use std::make_signed_t<std::...
John P's user avatar
  • 1,541
7 votes
0 answers
138 views

Understanding Raku's approach to Exception type hierarchy (or lack thereof)

Raku provides a number of exception types that, on a conceptual level, are subtypes of each other. For example, X::Bind::Slice is conceptually a sub-category of X::Bind. But at an object-hierarchy ...
codesections's user avatar
  • 9,520
7 votes
0 answers
126 views

Weird arrows in a Haskell heap profile

When producing a type heap profile (-hy) from a Haskell program, I get these results: ReaderT ->ReadertT ->>* (,) ->(#,#) What is the meaning of the '->' prefix (with one or more '>'...
Chatanga's user avatar
7 votes
0 answers
2k views

Extract BigQuery to Newline Delimited JSON without losing types

BigQuery Export Data Docs Previous Stackoverflow Post on Topic The bigquery.extract_data() function which extracts data from BigQuery into GCS does not maintain integer or float types. See below for ...
Canovice's user avatar
  • 9,892
7 votes
1 answer
1k views

Converting data frame columns in category type in pyspark

I have a data frame df and there I want to convert some columns into category type. Using pandas I can do it like below way: for col in categorical_collist: df[col] = df[col].astype('...
BC Smith's user avatar
  • 747
7 votes
1 answer
1k views

One or the other prop type for React component with Typescript

I'm trying to create a Table that renders either by a data prop or you can directly put custom rendered stuff via children. For that I need a type that accepts either data or children. I found these ...
Ronald Ruzicka's user avatar
7 votes
0 answers
1k views

Importing @types/kendo-ui in correct way without @progress/kendo-ui installed

I want to import the @types/kendo-ui in my project. But even WebStorm not provides me an automatic import function. Kendo-UI library is already load via <script /> so that I don't need to import ...
Patrick's user avatar
  • 144
7 votes
1 answer
3k views

Forward declare a Swift class to use it in an Objective-C header

I'm trying to import a Swift class into an Objective-C header file. I know that Project-Swift.h bridge can only be imported into implementation files (.m) but I've got an Objective-C header that needs ...
Shlomi Nissan's user avatar
7 votes
1 answer
152 views

Why does a variance annotation cause this subtyping relation not to be inferred by Scala?

In the code sealed trait Node[+T] case class I[C]() extends Node[C => C] def test[A, B](n: Node[A => B]) = n match { case i: I[c] => val cId: c => c = identity _ ...
Owen's user avatar
  • 39.2k
6 votes
0 answers
272 views

Generic types lose their Generic[T, ...] base class in the .pyi file generated by stubgen

Let's say there is a very simple class that represents a generic stack and hence is inherited from Generic[T] (§1). from typing import TypeVar, Generic, List T = TypeVar('T') class Stack(Generic[T]):...
kwokt's user avatar
  • 65
6 votes
2 answers
526 views

Is it possible to declare a typescript function which works on both numbers and bigints?

In plain untyped Javascript, it's not so hard to write a function which can operate on either numbers or bigints, depending on the arguments which are passed in: const sumOfSquares = (a,b) => a*a + ...
mlc's user avatar
  • 1,708

15 30 50 per page
1
2 3 4 5
315