haskell-platform

Using standard haskell generics libraries for typed type-isomorphisms

耗尽温柔 提交于 2019-12-20 17:36:04
问题 There are several generics libraries with numerous overlapping modules in just the Haskell Platform alone ( syb , Data.Typeable , Data.Data , GHC.Generics ), but I'm having trouble with a very basic generic programming task. I want to be able to convert between types of the same shape, i.e. I want a polymorphic, typed conversion function between isomorphic types, essentially what is offered at the end of this paper(PDF) where indexed type families are mentioned. I'm not concerned with

How do I create an operator in Haskell?

懵懂的女人 提交于 2019-12-20 10:23:21
问题 Making a ternary logic table, and I would like to make my own function for an operator that I'll call <=> . So, for example, I want to do this, but that isn't right. what's the correct way to do this? data Ternary = T | F | M deriving (Eq, Show, Ord) <=> :: Ternary -> Ternary -> Ternary <=> T F = F <=> T T = T <=> T M = M <=> F F = T <=> F T = F <=> F M = M <=> M F = M <=> M T = M <=> M M = T 回答1: Just add parentheses around your operator: (<=>) :: Ternary -> Ternary -> Ternary (<=>) T F = F

Compiling Haskell code in Cygwin, and some other bugs in Haskell Platform on Windows

五迷三道 提交于 2019-12-19 19:53:29
问题 I am trying to compile a simple hello world program in Haskell, with Haskell Platform 2011.2.0.1. If I load the code in WinGHCi, and use the GUI to compile, the .exe is created. Then I can run the .exe from Cygwin. But if I try to compile the code in Cygwin (using ghc --make ), linker fails. But again, if I compile from the Windows cmd prompt, then the compile+linker works fine. Are there any other environment variables I need to import into Cygwin, to make the compile+linker work in it? I

How to change path of cabal config file?

…衆ロ難τιáo~ 提交于 2019-12-19 06:13:18
问题 I am using HaskellPlatform-2012.4.0.0 on Win7. It's installed as portable. Paths are managed through .bat file so ghci and ghc works. But cabal installs it self at C:\Users\name\AppData\Roaming\cabal\ To circumvent that I did: cabal update edit config file delete all files except config Changed paths: remote-repo-cache: d:\h1\cabal\packages world-file: d:\h1\cabal\world build-summary: d:\h1\cabal\logs\build.log It works, but it's far from truly portable. Cabal config is bigger problem. It

Installing Haskell on Windows, cabal config

只谈情不闲聊 提交于 2019-12-18 09:02:34
问题 I'm installing Haskell on Windows based on the instructions at https://www.haskell.org/platform/ and looking at step 3, it says, Modify your cabal config file (you can verify the location by running "cabal user-config init") to contain the following lines: extra-prog-path: C:\Program Files\Haskell Platform\8.0.2\msys\usr\bin extra-lib-dirs: C:\Program Files\Haskell Platform\8.0.2\mingw\lib extra-include-dirs: C:\Program Files\Haskell Platform\8.0.2\mingw\include But the auto generated config

Installing Haskell on Windows, cabal config

流过昼夜 提交于 2019-12-18 09:02:21
问题 I'm installing Haskell on Windows based on the instructions at https://www.haskell.org/platform/ and looking at step 3, it says, Modify your cabal config file (you can verify the location by running "cabal user-config init") to contain the following lines: extra-prog-path: C:\Program Files\Haskell Platform\8.0.2\msys\usr\bin extra-lib-dirs: C:\Program Files\Haskell Platform\8.0.2\mingw\lib extra-include-dirs: C:\Program Files\Haskell Platform\8.0.2\mingw\include But the auto generated config

Haskell program outputs `<<loop>>`

核能气质少年 提交于 2019-12-17 16:32:23
问题 I wrote a Haskell program that preforms a binary search on a list. At least that's what I thought it does. When I compiled the program with ghc v7.6.3 and ran the program I got the following output: progname: <<loop>> What on earth does this output mean? Does it mean I had an infinite loop that ghc optimized away? How am I supposed to debug this? 回答1: As several of the comments have said, this is the Haskell RTS detecting an infinite loop at run-time. It cannot always detect such loops, but

Ambiguous occurrence `Just'

风格不统一 提交于 2019-12-13 14:15:42
问题 I am an absolute beginner. Going through LYAH using emacs. My current Set up: Ubuntu 12.04 LTS (Use Experience - beginner) GNU Emacs 23 (Use Experience - beginner) able to work in haskell major mode Finding difficult to follow instructions (to bring haskell libraries) at Point 2 described here. Also need guidance to enable Scion IDE. Problem: .hs code data Maybe a = Nothing | Just a While running the code, I get following error: Please ignore typo error, Originally posted: *Main> just "Haha"

Haskell reinstall base with profiling enabled

谁说胖子不能爱 提交于 2019-12-12 08:23:26
问题 I am trying reinstall my Haskell libraries with profiling enabled by following the instructions listed here However, whenever cabal attempts to reinstall one of the libraries I get the following message: LibraryNameHere.hs:1:1: Could not find module `Prelude' Perhaps you haven't installed the profiling libraries for package `base'? Use -v to see a list of the files searched for. When I try to reinstall base with profiling enabled I get the following messages: me@machine:~/.cabal/$ cabal

Cabal rebuild all with enable-shared flag

家住魔仙堡 提交于 2019-12-09 18:06:24
问题 I am having an issue with building a shared library with ghc and I think I need to rebuild my haskell packages with --enable-shared, is there an easy way to rebuild all of my packages with cabal with the flag --enable-shared? 回答1: If you have a ~/.cabal/world, cabal install --reinstall --enable-shared world could work, but test with the --dry-run flag first. That will, however only take care of cabal-installed packages. If you have packages installed with your distro's package manager, the