Questions tagged [hugs]

Hugs 98 is a functional programming system based on Haskell 98.

Hugs is a compiler which implements most of the Haskell 98 standard but deviates from it in a few minor ways. Features include:

  • Lazy evaluation, higher order functions, and pattern matching.
  • A wide range of built-in types, from characters to bignums, and lists to functions, with comprehensive facilities for defining new datatypes and type synonyms.
  • An advanced polymorphic type system with type and constructor class overloading. All of the features of the Haskell 98 expression and pattern syntax including lambda, case, conditional and let expressions, list comprehensions, do-notation, operator sections, and wildcard, irrefutable and `as' patterns.
  • An implementation of the Haskell 98 primitives for monadic I/O, with support for simple interactive programs, access to text files, handle-based I/O, and exception handling.
  • An almost complete implementation of the Haskell module system.
  • Hugs 98 also supports a number of advanced and experimental extensions including multi-parameter classes, extensible records, rank-2 polymorphism, existentials, scoped type variables, and restricted type synonyms.
65 questions
0
votes
3 answers

Syntax error in expression (unexpected `;', possibly due to bad layout) in line 50

Hello I'm writing this code as a beginner Haskell project that solves a very basic version of minesweeper. Details are unimportant but I keep getting a syntax error on line 50 in the isGoal function Syntax error in expression (unexpected `;',…
0
votes
3 answers

Evaluating undefined elements in Haskell data types

if I try > fst(a, b) where a, b are undefined, I get the error that b is undefined. Even on trying snd(a, b) it is b that causes the error first. I have a background in imperative programming. I am wondering if this is some kind of laziness that I…
schatten
  • 13
  • 2
0
votes
1 answer

Hugs Permutations Sufficient Space

First of all, yeah I know that I should use ghc instead (but we are forced to use hugs in the course) So I try to generate all permutations of [1 .. 9] but when evaluating this, hugs throws an error: "ERROR - Garbage collection fails to reclaim…
Ben373
  • 951
  • 7
  • 16
0
votes
1 answer

fetch environment variables in a cgi with haskell/hugs without a package

I am writing a cgi-script in Haskell. I am restricted to use only hugs/runhugs. #!/opt/local/bin/runhugs module Main where main = do putStrLn ("content-type: text/plain\n") putStrLn ("Hello, Server!") So far so good. But now I…
azbc
  • 399
  • 1
  • 5
  • 12
0
votes
2 answers

Error: Ambiguous class occurrence "Ord"

data (Ord a) => Stree a = Null | Fork (Stree a) a (Stree a) mkStree :: (Ord a) => [a] -> Stree a mkStree [] = Null mkStree (x:xs) = Fork (mkStree smaller) x (mkStree larger) where (smaller,larger) = partition (<= x) xs …
marco
  • 617
  • 2
  • 9
  • 18
0
votes
1 answer

Installing Hugs 98 on macOS sierra

I am having trouble installing Hugs 98 on macOS Sierra. I have followed the instructions here (http://www.willamette.edu/~fruehr/154/HugsMacInstall.html) which tell me to install macports then run sudo port install hugs98. Unfortunately, this…
0
votes
1 answer

How to Install Hugs Compiler in ubuntu?

I want to program in Haskel, a functional programming language and I want to install Hugs compiler for that in Ubuntu. Does anybody have any idea about it's installation.
Abdul Malik
  • 306
  • 1
  • 12
0
votes
1 answer

What is wrong with my Haskell code?

My code: addConcat :: [Int] -> [Int] addConcat [x,y] = z:(z + y) where (z = x + y) I'm implementing a function not exactly the one above but it's of the same format and I always get: Syntax error in input (unexpected symbol "y") So what is wrong…
thelili018
  • 43
  • 1
  • 6
0
votes
1 answer

Word count of a file with haskell

I have a problem with Haskell when i am trying to count the words of a file. I am just a beginner and this is my first program so i am pretty sure that it is a very simple mistake. I am using hugs to run my code. Until now i learnt how to read from…
user3104760
  • 143
  • 6
0
votes
1 answer

Cannot infer instance using evaluator

I've started to work through http://www.cs.nott.ac.uk/~pszgmh/monads for a intro on functional programming course. What better way to try and understand stuff than to actually try and test the code. Alas, on the second page I encounter the…
Apeiron
  • 602
  • 6
  • 17
0
votes
0 answers

Undefined data constructor "?" in Hugs intepreter

Strange error when attempting to load file into hugs: Hugs> :l test.hs ERROR "test.hs":3 - Undefined data constructor "?" Full content of file (yes, one line): test :: [a] -> ([a],[a]) Can anyone enlighten me? Note: Attempting to load the…
abc32112
  • 2,457
  • 9
  • 37
  • 53
0
votes
2 answers

Computing complex polynom value

I want to compute value of a complex polynomial at the given point, in haskell. Polynomial is given as a list of ((Int,Int),Int) elements, where the pair (Int,Int) stands for real and imaginary unit of the quotient, and the remaining Int represents…
Milos
  • 518
  • 7
  • 22
0
votes
1 answer

Haskell - Type error in application: Type does not match

I am getting a matching error: Expression : parseExpr (append p e) es Term : parseExpr Type : Expr -> String Does not match : a -> b -> c when I try executing this code in the marked line: data Expr = Atom String | Var…
SalmaFG
  • 2,022
  • 3
  • 23
  • 36
0
votes
1 answer

Haskell: Syntax error in input (unexpected `=')

I am trying to implement a function that compares 2 lists to see if they are the same. The syntax looks fine to me: compare :: String -> String -> Bool compare [] [] = True -- error here compare (x,xs) (y,ys) = if x == y then…
SalmaFG
  • 2,022
  • 3
  • 23
  • 36
0
votes
2 answers

Why must named functions be in a separate file in hugs?

In Haskell in 5 steps the factorial function is defined as follows: let fac n = if n == 0 then 1 else n * fac (n-1) But for hugs, it says that fac needs to be in fac.h. Can anyone explain why this is the case - missing the ability to define named…
Casebash
  • 114,675
  • 90
  • 247
  • 350