Haskell 128bit showing [closed] - haskell

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
My Question is that: Is it possible to show (2^63::Int) in 128 bit in Haskell?
Because of Int abs (2^63::Int) will not work because of the Int, but What If I have a 128 bit computer or compiler is it possible then to show the result?
Of course if it is possible, then please show me the way :)

According to the Report, this question is implementation specific:
The finite-precision integer type Int covers at least the range [-2^29, 2^29-1]. As Int is an instance of the Bounded class, maxBound and minBound can be used to determine the exact Int range defined by an implementation.
I know of no implementations for which maxBound :: Int is larger than 2^63-1.

Related

Typo in Learn you a Haskell for Great Good? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
In Type Synonyms we read
Just like we can partially apply functions to get new functions, we can partially apply type parameters and get new type constructors from them.
How can a parameter be applied to something else? I think it should actually be
Just like we can partially apply functions to get new functions, we can partially apply type constructor (giving them less type parameters then they expect) and get new type constructors from them.
Do you agree?
The author seems to use apply to mean both "the function to the parameters" as well as "the parameters to the function".
Further down we read
we'll partially apply Either by feeding it only one parameter
Where the meaning is the former,
as well as
Let's apply the type parameter to Maybe and see what the kind of that type is.
ghci> :k Maybe Int
where the meaning is the latter.

Can you change the type of cons (:) in haskell [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Cons has the input as a -> [a] -> [a]
Can you change cons to be
a -> a -> a
without a list type?
No, you cannot change the type of (:). It is defined in Prelude. If you want a function with a different type, you just need to write that function yourself and give it an appropriate name.

What are some intuitions that support calling the Maybe constructor in Haskell "Just"? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
The intuition of an optional type like Maybe Int is that either there is no Int (thus, there's Nothing there) or that there is some Int; there is something there.
It makes sense to me that we call the type constructor for the "negative" case Nothing, since it means exactly that -- that there's no Int there. But why use the word Just in the case where the emphasis is on something actually being there?
To me, the word "Just" carries the connotation that the thing it's describing is less than the alternative; the opposite of something actually being there; for example,
A: Are you doing anything tonight?
B: No; I'm just gonna stay in and watch TV.
A: Did you investigate the creepy ghost sounds around your house?
B: yeah, turns out it was actually just an owl.
Clearly I'm lacking whatever intuition this naming choice was based on. What is it? Because to me, the word Just means the opposite of how it's used in the Maybe type.

What do you call the collection of types that obeys certain constraints? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Given a function
f :: Vector a => a -> b
we would call a a type (or type variable), and Vector a constraint. But what do we call the collection of all types that satisfy Vector a => a? I've been informally calling it "the set of Vector spaces" and I call any member type a "Vector space". Are there more accurate type-theoretic names I should be using? In particular, are the words "set" and "space" used correctly?

Is it possible to convert an IO type to Arbitrary? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am building a Sudoku solver in Haskell, and I have two functions:
genProblemm :: Node -> IO Node
newSudoku :: IO Node
for generating Sudoku puzzles. I would like to use the QuickCheck library to test my solver. Is it possible to make Node an instance of Arbitrary, using these functions? I couldn't find a general way...
I only got as far as the type:
instance Arbitrary Node where
arbitrary =
... but I don't know how to write arbitrary using my existing functions, which both are IO types.
edits:
Node = (Sudoku, [(Column, Row, [Int])])
type Sudoku = (Row,Column) -> Int
A Node is the whole Sudoku.

Resources