Functional Programming

Why does my implementation of Haskell snd not compile in Scala?

I defined the following function along the lines of Haskell sndTrying to use it with a List[ListNode[T]] doesn't compile. Why not?where:Error:


Typed Tagless Final Interpreters: what is the use of duplicate?

This question is related to the paper Typed Tagless Final Interpreters. In page 11, a function trice is presented, which relies on a duplicate …

Electric Vehicles

Returning a subset of types in Haskell

I'm trying to restrict the return type of a function to a subset of (kind) constructors. I can use typeclasses to restrict the input types, but when …


Why My Haskell Code is so slow compare to Swift and C

Here is very simple Haskell code to find all the Pythagoras integers from 1 to 200 that satisfied the Pythagoras Theorem X^2 = Y^2 + Z^2Haskell:It …


How to separate lines of a LaTeX eqnarray in Haddock markup?

I can't seem to get this simple LaTeX code, embedded in a Haskell comment, to render properly when run through Haddock with HTML target:When I run …


Learn New Technology as a Way of Stepping Up Your Understanding of Your Current One

One common question for software developers is how to progress from "intermediate" to "senior"—whatever those titles mean. A lot of the journey is …


Are there any compile to Haskell languages? [on hold]

Has anyone attempted to build a new frontend for Haskell with Java like syntax? Or any other syntax?


If TDD is Zen, adding Serverless brings Nirvana

Today we are going to build the dream backend for your startup with TDD and Serverless.<p>Traditional API server have come a long way, but today’s fast …


How to use the Haskell program, can I develop java code on a Haskell project? [on hold]

Recently I have done some research on my area, however, I found a project I need is written in the Haskell language.I have tried to compile this …


Haskell explicit recursion vs `iterate`

While writing a function using iterate in Haskell, I found that an equivalent version with explicit recursion seemed noticeably faster - even though …


How to vectorize a python function that loops over an array of 3D points?

Here is the code:I have profiled it with kernprof and gotten this:So this part is taking most of the time:I want to see if the time loss is caused by …

Python Programming

Is there a way to install an Haskell executable as a dependency?

I found myself writing Haskell commands based upon other commands provided by other Haskell packages, but i could not find a way to install an …


What does the map function in the Applicative from Category theory do?

Given the following statement about functional programming - in particular reasoning about category theory - we see the map function inside the …


Why were FEXPRs abandoned in Common Lisp?

Many LISPs had FEXPRs but they were not included in CL.<br>I read that this was because FEXRPs don't work well with static analysis.<br>Can someone explain …

Common Lisp

Getting a count of the number of successful updates

I've got a Scala function that inserts an entry into a MySQL database. I'd like to keep a count of the number of entries that were successfully …


Haskell's mapM when there are 3 monadic results

Now and again I keep running into Haskell code where I feel like I should be able to use mapM to make operating over the monads cleaner, but if I …


Probabilistic Functional Programming

Posted on July 17, 2018<p>Tags: Haskell, Probability<p>Here are the slides for a short talk I gave to a reading group I’m in at Harvard today. The speaker …

Programming Languages

Data Science for Startups: Model Services

Source:<i>Part two of my data science for startups</i> <i>serie</i><i>s focused on</i> <i>Python</i><i>.</i>In order for data scientists to be effective at a startup, they …

Python Programming

Why is colon right associative in this expression?

Because function application is left associative in Haskell, I expectto be equivalent to ('x':'y'):"z". ('x':'y') is an error, because 'y' is not a …


How can I pass an object attribute to lambda function, as function parameter?

I created two functions that returns a sorted a list. Both of them take as argument a list containg instances of Employee Class. The first sorts by …

Python Programming

How to balance equilibrium writing functions on functional programming in R

I am starting to use the "functional programming paradigm" in R. I am starting with "map" functions from "purrr" package. When I code with imperative …


Defining new types in Haskell - RPS game

I'm completely new to Haskell (and more generally to functional programming), so forgive me if this is really basic stuff. I'm reading Real World …


PhD Abstracts | Journal of Functional Programming

To send this article to your Kindle, first ensure is added to your Approved Personal Document E-mail List under your Personal …


Kotlin Programming Guide

Are you ready to upgrade from Java? Learn the new language that’s taking the Android world by storm in Kotlin Programming: The Big Nerd Ranch …


gcc7 lambda expression return type without arrow

I wrote the following by accident and got no warning with gcc 8:I've never heard or read anything about the previous syntax. My intent was to …


Why isn't GHCi letting me annotate my types with kinds?

I found out about Kinds while reading a History of Haskell paper and tried to run some of the examples at the Haskell Wiki.When I do, I get the …


bind can be composed of fmap and join, so do we have to use the monadic function a -> m a?

I don't use Haskell a lot, but I understand the concept of Monads.<p>I had been confused by Kleisli triple, and the category, however,<p>fmap and …


Is it possible to build a Restful API in Haskell without using Reader/Writer/State Monad or Monad Transformer

As a beginner, I feel Reader/Write/State Monad is difficult to understand. And Monad Transformers is even more difficult. I don't see the usage of …


How to disable the > exception when compiling Haskell with GHC?

If my program reaches an infinite loop, I would like it to actually get stuck: run forever, run out of memory or crash with a stack overflow.I don't …


Scala - How to avoid a var here

I wonder if anybody knows how to avoid the var in the following pseudocode: