language-extension Questions
2
Solved
I am aware that there is a GHC extension, OverloadedStrings, which allows string literals (delimited by ") to become polymorphic, similar to the built-in behavior for number literals.
My question ...
Hopple asked 16/11, 2019 at 12:36
1
Solved
Suppose I define a multi-parameter type class:
{-# LANGUAGE MultiParamTypeClasses, AllowAmbiguousTypes, FlexibleContexts, FlexibleInstances #-}
class Table a b c where
decrement :: a -> a
ev...
Esparza asked 7/6, 2019 at 2:49
3
Solved
While describing the NegativeLiterals School of Haskell shows an example of how using the language extension might change the performance of some code and then says
Other examples might actually...
Virgievirgil asked 15/1, 2018 at 18:27
2
Solved
For any .hs file, you can specify the language extensions you rely on like so:
{-# LANGUAGE Foo, Bar, Baz #-}
A cabalized project can also specify language extensions on a per-project basis in t...
Foin asked 2/3, 2012 at 22:13
1
Solved
With -XTypeApplications in GHC 8.0, you can specify types explicitly with @ preceding function arguments. What types does it exactly specify, especially when several @ are introduced?
Gribble asked 27/10, 2016 at 2:20
3
Solved
I saw a program in C that had code like the following:
static void *arr[1] = {&& varOne,&& varTwo,&& varThree};
varOne: printf("One") ;
varTwo: printf("Two") ;
varThree: p...
Pot asked 6/9, 2016 at 21:9
3
Solved
Why will coroutines (as of now in the newest drafts for C++1z) be implemented as a core language feature (fancy keywords and all) as opposed to a library extension?
There already exist a couple of...
Refractive asked 31/1, 2016 at 23:59
1
Solved
I find myself using this sort of pragma a lot in my cabal projects to force GHC to build with specific options:
{-# OPTIONS_GHC -XFlexibleInstances -XRankNTypes ... #-}
But when I see other peop...
Conidiophore asked 18/4, 2015 at 17:59
1
Solved
OverloadedStrings extension is really very useful, however it has some downsides.
Consider the following function definition:
someFunction :: ToJSSTring a => a -> IO ()
someFunction = js_fun...
Longo asked 6/11, 2014 at 11:31
5
Solved
What is the simplest and least obtrusive way to indicate to the compiler, whether by means of compiler options, #defines, typedefs, or templates, that every time I say T, I really mean T const? I w...
Perfect asked 4/5, 2010 at 5:12
4
Solved
I just discovered this old C++0x draft about modules in C++0x.
The idea was to get out of the current .h/.cpp system by writing only .cpp files which would then generate module files during compil...
Geographical asked 29/8, 2010 at 19:3
1
In this response, tloveless pointed out that it's possible in MSVC to use this->foo::foo(42); for constructor delegation to directly call a constructor:
#include <iostream>
struct foo
{
...
Eveliaevelin asked 28/4, 2014 at 17:26
1
Solved
The OverloadedLists language pragma in GHC 7.8 is quite attractive, so I decided to try it:
{-# LANGUAGE OverloadedLists #-}
import Data.Set (Set)
import qualified Data.Set as Set
mySet :: Set ...
Accommodate asked 25/4, 2014 at 0:38
2
Solved
The answer to the question Is it possible to create custom operators in JavaScript? is not yet, but @Benjamin suggested that it would be possible to add a new operator using third party tools:
I...
Progenitive asked 24/12, 2013 at 14:7
1
Since these flexible contexts and instances aren't available in the Haskell standard, I assume there are potential problems when using them. What are they? Can they lead to some ambiguity, undecida...
Gaither asked 14/8, 2013 at 10:41
1
Solved
From GHC's manual, Section Safe Language:
Module boundary control — Haskell code compiled using the safe language is guaranteed to only access symbols that are publicly available to it through o...
Barkeeper asked 16/6, 2013 at 19:56
1
Solved
I'm trying to understand monad transformers by implementing my own tiny library based on the designs of existing ones.
What I'm stuck on is the language extensions. In MonadError, the only extens...
Jellybean asked 1/3, 2013 at 10:38
1
Solved
Suppose a Haskell library designer decides to use UndecidableInstances for some reason. The library compiles fine. Now suppose some program uses the library (like defines some instances of its type...
Lanneret asked 23/1, 2013 at 9:25
1
Solved
The code below uses an unsafe GeneralizedNewtypeDeriving extension to break Data.Set by inserting different elements with different Ord instances:
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
impor...
Rill asked 4/10, 2012 at 20:23
7
I don't usually code C++, but a strange comp sci friend of mine got sick of looking at my wonderful FORTRAN programs and challenged me to rewrite one of them in C++, since he likes my C++ codes bet...
Stereoisomerism asked 28/9, 2011 at 18:53
1
Solved
I'm trying to enable XRankNTypes in GHCi. How do I do this?
Firecracker asked 25/9, 2012 at 14:15
1
Solved
I have had the experience a few times now of having GHC tell me to use an extension, only to discover that when in using that extension I have made code far more complex when a simple refacto...
Dozen asked 1/6, 2012 at 6:2
1
Solved
I read this:
http://hackage.haskell.org/trac/ghc/wiki/ViewPatterns
I like the idea, want to use the extension. I however would like to make sure as to one thing: whether the view function is eval...
Fushih asked 20/1, 2012 at 20:12
2
Solved
Using systems such as Parallel Linq, it's possible to split up execution of anonymous functions, queries, etc across multiple cores and threads within a single machine. I'd like the ability to exte...
Liberate asked 28/12, 2011 at 18:8
2
Solved
I was just doing some Haskell development and I recompiled some old code on a new version of GHC:
The Glorious Glasgow Haskell Compilation System, version 7.2.1
And when I did I received the fol...
Orchestrion asked 15/9, 2011 at 23:28
1 Next >
© 2022 - 2024 — McMap. All rights reserved.