Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No instance for (Semigroup (Fragment a))" in Fragment.hs:33 #206

Open
i336 opened this issue Jun 13, 2018 · 8 comments
Open

"No instance for (Semigroup (Fragment a))" in Fragment.hs:33 #206

i336 opened this issue Jun 13, 2018 · 8 comments

Comments

@i336
Copy link

i336 commented Jun 13, 2018

Hi! I'm trying to compile Kitten so I can play with it.

I've never used Haskell before so I have no idea what's going on or how to proceed. I wouldn't be surprised if my GHC setup is broken.

$ git pull
Already up to date.

$ make
cabal sandbox init
Writing a default package environment file to
/data/kitten/cabal.sandbox.config
Using an existing sandbox located at /data/kitten/.cabal-sandbox
cabal install --enable-tests --only-dependencies
Resolving dependencies...
All the requested packages are already installed:
Use --reinstall if you want to reinstall anyway.
cabal configure --enable-tests
Resolving dependencies...
Configuring Kitten-0.1.0.0...
cabal build
Preprocessing library for Kitten-0.1.0.0..
Building library for Kitten-0.1.0.0..
[61 of 65] Compiling Kitten.Fragment  ( lib/Kitten/Fragment.hs, dist/build/Kitten/Fragment.o )

lib/Kitten/Fragment.hs:33:10: error:
    ⢠No instance for (Semigroup (Fragment a))
        arising from the superclasses of an instance declaration
    ⢠In the instance declaration for â
   |
33 | instance Monoid (Fragment a) where
   |          ^^^^^^^^^^^^^^^^^^^
make: *** [Makefile:86: dist/build/kitten/kitten] Error 1

I'm on Arch, for better or worse. Happy to shout at the package manager to try and figure out what to install.

btw: I'm sshing to my Arch box from a Slackware machine which has broken Unicode, which is the reason for the "â¢"s. GHC doesn't seem to respect LC_ALL=C!

@sullyj3
Copy link

sullyj3 commented Jun 13, 2018

Yep, you'll need an earlier GHC, from before the Semigroup Monoid Proposal. (https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid)
Longer term, probably (Fragment a) should get a Semigroup instance (the implementation is trivial).

@evincarofautumn
Copy link
Owner

This is an issue I should fix anyway, so thanks for the report. :) If you’re not familiar with Haskell build tooling, the most straightforward way to build is probably using Stack, which will install an appropriate GHC and the correct package versions for you in a sandbox—instructions are in the README. Honestly, I should probably just remove the Makefile since I haven’t been maintaining it.

@i336
Copy link
Author

i336 commented Jun 14, 2018

...I feel very stupid for not scrolling down and noticing the readme information. Woops.

But now it works! Now I just have to figure out what on earth to do with this thing. :P

Thanks very much, installing Stack was a simple pacman -S stack.

@sullyj3
Copy link

sullyj3 commented Jun 14, 2018

Can ghc not derive those instances?

@evincarofautumn
Copy link
Owner

@sullyj3 I don’t think so, but there are libraries for it like generic-deriving. I think that instance might actually go away in the next round of changes anyway—not sure it’ll be needed.

However, as long as there’s not too much of it, I often end up manually writing code like that instead of finding a way to cleverly avoid it, even though it’s purely mechanical. It only needs to be done once, and being explicit makes the code (in theory) easier to port over to Kitten if/when I want to bootstrap.

@sullyj3
Copy link

sullyj3 commented Jun 14, 2018

Oh yeah, I guess writing a deriving system for kitten would be super nontrivial.

@evincarofautumn
Copy link
Owner

@sullyj3 Yeah, not necessarily hard, just Yet Another Thing to do. Incidentally, I’m leaning toward doing deriving with macros (#141) when I get around to it, so at least those things can be written in Kitten instead of Haskell.

@evincarofautumn
Copy link
Owner

@i336 Glad you got it going! :) Feel free to come hang out on the Kitten Gitter channel if you have any questions or feedback. I’m happy to help you try things out—and explain and apologise for all the stuff that’s broken while I continue to take forever to fix it, hah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants