type-systems Questions
3
Solved
Swift 5.7 introduced primary associated types. While experimenting with this feature, I was wondering if there is still a use case for type erasure types like AnySequence or if primary associated t...
Cenis asked 11/6, 2023 at 8:38
0
(This question is under a permanent bounty of 1000 points, once proven/refuted, it will be retrospectively set up and awarded)
(Possible duplicate: https://math.stackexchange.com/questions/4232108/...
Zippel asked 31/1, 2023 at 1:12
2
Solved
I'm a newbie to Rust and type-systems. I'm reading rustc/rc.rs. I don't know why Rc<T> can call T's methods. What conditions does a Structure<T> satisfy for calling methods of the wrapp...
Paresis asked 22/12, 2019 at 4:44
5
cppreference.com states that char is
Equivalent to either signed char or unsigned char [...], but char is a distinct type, different from both signed char and unsigned char
I assume this means th...
Bowel asked 24/10, 2022 at 11:2
2
Solved
What is the difference when I write this?
data Book = Book Int Int
versus
newtype Book = Book (Int, Int) -- "Book Int Int" is syntactically invalid
Councilwoman asked 4/5, 2011 at 20:50
4
Solved
Before you start reading: This question is not about understanding monads, but it is about identifying the limitations of the Java type system which prevents the declaration of a Monad interface.
...
Hallee asked 11/3, 2016 at 23:36
3
Solved
I am trying to learn agda. However, I got a problem. All the tutorials which I found on agda wiki are too complex for me and cover different aspects of programming. After parallel reading of 3 tuto...
Skeg asked 26/2, 2012 at 18:20
2
A simple demo of dependent types in Idris is Vector, whose type depends on its value.
We can use type hints in Python:
from typing import List
def append(a: List[int], b: List[int]) -> List[i...
Aggie asked 8/4, 2017 at 9:10
3
Solved
(Disclaimer: I'm not 100% sure how codatatype works, especially when not referring to terminal algebras).
Consider the "category of types", something like Hask but with whatever adjustmen...
Tomi asked 26/11, 2021 at 18:20
6
Solved
What is the difference between static and dynamic programming languages? I know that it is all about type systems, but I’m looking for more clear clarifications.
Shouse asked 13/12, 2013 at 9:50
3
Solved
Hoogle allows you to search many standard Haskell libraries by either function name, or by approximate type signature. I find it very useful. Is there anything like Hoogle for Scala? Search in Scal...
Lohman asked 20/5, 2010 at 11:41
4
Solved
Higher rank types look like great fun. From the Haskell wikibook comes this example:
foo :: (forall a. a -> a) -> (Char,Bool)
foo f = (f 'c', f True)
Now we can evaluate foo id without the...
Rightly asked 25/9, 2009 at 10:9
1
Solved
In the paper "Type classes: exploring the design space" by Simon Peyton Jones, Mark Jones and Erik Meijer, they define coherence informally as follows:
Every different valid typing deriv...
Ivanna asked 16/6, 2021 at 16:0
4
Solved
I'm trying to understand the relation between a logic programming language(Prolog in my case) and Haskell's type system.
I know both use unification and variables to find values(or types, in Haske...
Daudet asked 16/12, 2012 at 8:1
3
Solved
I know that Java's type system is unsound (it fails to type check constructs that are semantically legal) and undecidable (it fails to type check some construct).
For instance, if you copy/paste t...
Fernand asked 29/5, 2014 at 17:20
5
Solved
Here's a function polymorphic in 3 types:
:t (.)
(.) :: (b -> c) -> (a -> b) -> a -> c
and here a non polymorphic function:
:t Data.Char.digitToInt
Data.Char.digitToInt :: Char ->...
Wundt asked 11/12, 2020 at 20:17
3
Solved
I want to return an error from a function in case a condition is true:
use std::error::Error;
pub fn run() -> Result<(), Box<dyn Error>> {
// -- snip ---
if condition {
// retu...
Ulda asked 27/7, 2018 at 3:2
2
Solved
I create a lot of data processing pipelines using mass spectrometry data, where data from the instrument gets cleaned up, transformed, scaled, inspected, and finally analyzed. I tend to use a recur...
Kesha asked 31/8, 2020 at 16:13
2
Solved
Compiling without Continuations describes a way to extend ANF System F with join points. GHC itself has join points in Core (an intermediate representation) rather than exposing join points directl...
Flyblow asked 2/8, 2020 at 14:44
1
Solved
Why this scala code
case class Foo[T]() {
def bar(tt: T): Unit = ???
def bar_(s: String)(implicit ev : T =:= String): Unit = bar(s)
}
triggers this compilation error
[error] type mismatch;
[erro...
Tussock asked 11/7, 2020 at 12:44
2
I found myself really can't understand the difference between "Generic type" and "higher-kinded type".
Scala code:
trait Box[T]
I defined a trait whose name is Box, which is a type constructor ...
Tillietillinger asked 24/6, 2014 at 3:43
4
Solved
Is it possible to place an inequality constraint on the typevariables of a function, à la foo :: (a ~ b) => a -> b as in GHC type family docs, except inequality rather than equality?
I reali...
Britten asked 4/8, 2011 at 9:30
2
As mentioned in TypeScript handbook:
One of TypeScript’s core principles is that type-checking focuses on the shape that values have. This is sometimes called “duck typing” or “structural subtyp...
Anastassia asked 1/5, 2018 at 14:18
6
Reading Disadvantages of Scala type system versus Haskell?, I have to ask: what is it, specifically, that makes Haskell's type system more powerful than other languages' type systems (C, C++, Java)...
Tapley asked 24/9, 2010 at 14:20
1
Consider this code:
const obj = {
a: 1,
b: 2
}
let possibleKey: string = 'a'
if (possibleKey in obj) console.log(obj[possibleKey])
When possibleKey in obj is true, we know that possibleKey h...
Spanishamerican asked 7/1, 2020 at 12:20
1 Next >
© 2022 - 2024 — McMap. All rights reserved.