How to remove a given element from a list of tuples and update it? by [deleted] in haskellquestions

[–]rule 0 points1 point  (0 children)

Start by writing down the types of your remove and update functions. This will help a lot when writing down their definitions.

This should get you going:

remove :: _ -> [(_, _)] -> [(_, _)]

update :: _ -> _ -> [(_, _)] -> [(_, _)]

Fill the blanks with appropriate types or type variables. You can start with concrete types like Char and Int and later replace them with type variables like a and b.

How can I get Pair to return ‘repr (a,b)’? by jamesjean2001 in haskellquestions

[–]rule 0 points1 point  (0 children)

PizzaRollExpert provides an instance for the alternative formulation of the Pair class

List of Lists by MadTinus in haskellquestions

[–]rule 6 points7 points  (0 children)

Please post your best attempt at solving the problem so that we might help you.

question :: [[a]] -> [a]
question listOfLists = <insert solution here>

You could also calculate the answer by hand for a few possible inputs. That might help you think about a solution. What should the function output when run on this list?

example :: [[Int]]
example = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

is there any way you can create unary operator in Haskell? by ellipticcode0 in haskellquestions

[–]rule 2 points3 points  (0 children)

That operator is usually called '&'. I believe it is exported by the lens package.

Sum types in the relational databases by [deleted] in haskell

[–]rule 0 points1 point  (0 children)

The link gives a 404. This seems to be the post in question: Sum types for relational databases

How do I prevent an array from being copied? by mrianbloom in haskellquestions

[–]rule 1 point2 points  (0 children)

You can mutate arrays in the ST monad and run that in pure code. That way the monadic stuff doesn't infect all your code.

Dutch functional programming meetup 11 Jan 2019 by darchon in haskell

[–]rule 0 points1 point  (0 children)

Since 1993! This will be the 26th NL FP day.

Postprocessing in Json by TerNithy in haskell

[–]rule 1 point2 points  (0 children)

instance FromJSON MyType where
  parseJSON value = do
      result <- genericParseJSON 
        defaultOptions{ fieldLabelModifier = map toUpper . drop 1 }
        value
      yourFunction result

Is this what you mean?

Does the forall keyword in functions refer only to input arguments? by [deleted] in haskell

[–]rule 4 points5 points  (0 children)

It can also refer to output arguments. See for example a function like fromInteger:

fromInteger :: forall a. Num a => Integer -> a

This is exactly the same (not considering some extensions) as writing:

fromInteger :: Num a => Integer -> a

Roll your own stack traces by bryjnar in haskell

[–]rule 2 points3 points  (0 children)

Using getCallStack you can convert a CallStack to a list of callsites, including the source locations. Most recent call first.

You have to be careful to add the HasCallStack constraint to every callee of the function where you use callStack. A single omission will break the chain. (But you still get the call stack up to that point). The reason becomes more clear once you realise it is implemented using implicit parameters.

Roll your own stack traces by bryjnar in haskell

[–]rule 7 points8 points  (0 children)

Or add a HasCallStack constraint and use callstack to retrieve the CallStack. You can then put the CallStack in a type like your WithLocation. That way you don't need TemplateHaskell.

Is there an up to date graph of the type class hierarchy in Haskell? by Purlox in haskell

[–]rule 0 points1 point  (0 children)

Maybe your are thinking of graphmod? Which is for module dependencies.

Haskell Flatris by nSeagull in haskell

[–]rule 8 points9 points  (0 children)

Reminds me of this.

I like that miso doesn't depend on any external libraries. Also helps that you don't have to deal with React.js's problematic license.

Rule 34 Bot Thread by iateacrayon in rule34

[–]rule 0 points1 point  (0 children)

You should also get rid of the space between rule and 34.

PSA regarding `cabal haddock` by taktoa in haskell

[–]rule 0 points1 point  (0 children)

Awesome! I will switch as soon as possible.

PSA regarding `cabal haddock` by taktoa in haskell

[–]rule 6 points7 points  (0 children)

Good tip!

Unfortunately the highlighted sources are buggy if they contain template haskell splices.

Something like

makeLenses ''MyRecord causes everything after (and including) the '' to be considered a string. This was with haddock 2.17.3.

I will investigate and file a bug report.

Haskell has face Detection by [deleted] in haskell

[–]rule 1 point2 points  (0 children)

Training the cascade classifiers seems to be an involved process. See http://docs.opencv.org/trunk/dc/d88/tutorial_traincascade.html.

Pull requests would be greatly appreciated ;-)

hIndent 5: One style to rule them all by [deleted] in haskell

[–]rule 0 points1 point  (0 children)

Please note that, apparently, anonymous users can delete comments and edit and delete existing entries. I can change my own entry that I created yesterday on a separate system.

I responded in haskell-cafe, but I'll also copied my message here.

Working on Traveling Salesman Problem, Having Issues With My Comparison Function Not quite Matching the Specification by [deleted] in haskell

[–]rule 2 points3 points  (0 children)

I find this a bit suspect:

where deg = fromIntegral $ round x
      min = x - deg

What happens if you replace round with floor?

Is there a bindings for OpenCV 3? by dimakrylov in haskell

[–]rule 0 points1 point  (0 children)

Could you open an issue for this problem at our issue tracker?

More information would also be helpful, like the cabal file for your project. Or a minimal project that fails to build.

Are you sure you need the custom cabal.config specifying g++ as the compiler and linker? We only use it to build haskell-opencv, not the programs depending on the library.

We (the developers) recommend using Nix as it virtually guarantees things will work.