last day (1867 days later) » 

8:03 PM
Aaron Hall has made a change to the feeds posted into this room
Aaron Hall has made a change to the feeds posted into this room
Aaron Hall has made a change to the feeds posted into this room
0
Q: Haskell - passing a function as a argument compilation error

BDillanI have a very simple function called 'fold' that takes a function f and executes it. Given a function 'add' and two numbers it calls add with those two numbers and displays the results. However I cannot compile it due to a compilation error below. What is the error specifically stating and what c...

3
Q: Unable to derive Applicative when combining two monad transformer stacks

JeffI've written two monads for a domain-specific language I'm developing. The first is Lang, which is supposed to include everything needed to parse the language line by line. I knew I would want reader, writer, and state, so I used the RWS monad: type LangLog = [String] type LangState = [(Stri...

0
Q: Make type showable.

GilgameszHow to make type Showable? type InterpreterMonad = StateT (Env, Env) (ErrorT String IO ) () Normally, I would type deriving Show but I have a type not newtype or data. P.S. How to write above with newtype?

0
Q: Monad State And get function

J. Doetype InterpreterMonad = StateT (Env, Env) (ErrorT String IO ) () interpreter :: Stmts -> InterpreterMonad interpreter (Statements s EmptyStmts) = interpreteStmt s interpreter (Statements s stmts) = interpreteStmt s >>= \m -> (interpreter stmts) -- definicja funkcji interpreteStmt :: Stmt ->

1
Q: Separation of Concerns: when is it best to disassociate semantics from syntax?

Musa Al-hassyChoices Typeclasses are brilliant in that they allow us to adjoin extra structure to existing types. Thereby allowing us to defer some design decisions rather than making rushed decision at the time of conception. On the other hand, in object oriented programming, for example, we are forced to ...

2
Q: Difference between Python classes and Haskell typeclasses

dopatramanI'm an intermediate Python dev and just starting out with Haskell. It seems like Python's classes can be used in a way that is similar to how Haskell's typeclasses are used. It seems like typeclasses are just a way to implement operator overloading. Like this: # main.py class MyClass: def __...

5
Q: Why isn't Bounded a subclass of Enum in Haskell

semicolonIt seems like any Bounded instance should have a sane implementation of Enum. I cannot personally think of a counterexample, although if someone comes up with one that isn't pathological then I will understand why this isn't the case. From doing :i on the two typeclasses it seems like the only e...

18
Q: Could Hindley-Milner inference work for the Go language?

JanKanisI've read that Hindley-Milner does not work with type systems that have subclasses, and there are other type system features that also do not work well with it. Go currently has only very limited type inference in the := operator. But Go does not have subclasses in the traditional sense, only int...

3
Q: Can a function be polymorphic and overloaded?

Ryan SmithIn Graham Hutton's book "Programming in Haskell", he defines a function to be polymorphic, if its type "contains one or more type variables". He then defines a function to be overloaded, if its type "contains one or more class constraints". From these definitions, my question is, "can a function...

2
Q: Event driven programming in Haskell

user3821009I'm new to Haskell, so this is more a high-level conceptual question. I've read this: https://wiki.haskell.org/Real_World_Applications/Event_Driven_Applications and it has this: run :: Domain -> [Event] -> IO () run dm [] = do events <- uiUpdate dm run dm events run _ (EventExit:_) = ret...

3
Q: Find biggest palindrome which is the product of two 3-digit numbers

PignaisPalindrome :: Integer -> Bool isPalindrome n = reverse x == x where x = show n is3x3 :: Integer -> Bool is3x3 n = any (\x -> cond1 x && cond2 x) [101..999] where cond1 x = n `mod` x == 0 cond2 x = length (show $ n `div` x) == 3 main = print $ head [p | p <- [999^2,999...

3
Q: Simple Haskell Chess

Sean DJust for fun I tried to write a chess game in Haskell, in the hope that it would eventually be good enough to beat me. It's not perfect at the rules (it doesn't know about promotion, castling or en-passant yet) but it does manage to make legal moves, and they're not always totally stupid. I've tr...

7
Q: Bucket sort in Haskell

stewbasicAs a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array c of length 200, increment c[h] for each height h, compute cumulative sums of c and then binary s...

3
Q: Idiomatic Leap years in haskell

Thomas FrancoisI wrote a simple function to determine if a year is a leap year or not. It works, but does not feel idiomatic. isLeapYear :: Int -> Bool isLeapYear year = (mod year 400) == 0 || ((mod year 4) == 0 && not ((mod year 100) == 0)) Is there a more "haskelly" way to write this function ?

3
Q: Haskell - Pig Latin Translator

BalinKingOfMoriaWhat improvements can I make to the following Pig Latin translator? So far, I've been wondering about the FlexibleInstances declaration, but I can't think of how to remove it (since it's required for PigLatin String in instances, which is required for me to use " " in the Monoid instance; I need ...

 
room topic changed to Haskell: Haskell w/ Feeds - if too many feeds, click Feeds user, and "hide posts" to temporarily hide, or "ignore this user (everywhere)" if you really hate them. [haskell]
 
0
Q: Is it possible to write a Just In Time (JIT) compiler for Haskell?

ShivanKaulI'm interested in learning more about how Haskell compiles down to native code. I understand that Haskell is statically typechecked, which is why you might not want to do this. But is it possible?

 
This site looks like a good place to start learning haskell: haskell.org
 
 
1 hour later…
9:19 PM
0
Q: Modular Haskell sudoku solver

Richárd NagyI'm a cs student, and I have a class about functional programming. I have an assignment in Haskell. It's about writing a sudoku solver. All the type-definitions are given, I cannot change them or write any more. I got all the way to the end, but cannot seem to be able to write the last, solve fun...

 
 
1 hour later…
10:46 PM
0
Q: Haskell: Reading from FS to "dynamically" create widgets in taffybar

McEnroeI'm trying to use taffybar as my status bar (uses Dyre framework so configuration is code). It has a widget that can show network interface statistics. In the default configuration this widget requires a String at compile time. I want it to create a widget per (non-loopback) interface dynamically...

 

  last day (1867 days later) »