-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experiments | ghc: well-typed/generics-sop#89
- Loading branch information
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE MultiParamTypeClasses #-} | ||
{-# LANGUAGE QuantifiedConstraints #-} | ||
{-# LANGUAGE TypeInType #-} | ||
{-# LANGUAGE UndecidableSuperClasses #-} | ||
{-# LANGUAGE UnicodeSyntax #-} | ||
{-# OPTIONS_GHC -Wextra -Wno-unused-imports -Wno-unticked-promoted-constructors -Wno-type-defaults -Wno-missing-signatures #-} | ||
|
||
module Main where | ||
|
||
import Control.Monad.IO.Class | ||
import qualified GHC.Generics as GHC | ||
import Generics.SOP | ||
import qualified Generics.SOP as SOP | ||
|
||
|
||
class ( GHC.Generic a, SOP.Generic a, HasDatatypeInfo a | ||
, forall xs. Code a ~ '[xs]) => Foo m a where | ||
|
||
instance ( GHC.Generic a, SOP.Generic a, HasDatatypeInfo a | ||
, forall xs. Code a ~ '[xs] | ||
, Monad m) => Foo m a where | ||
|
||
-- error: | ||
-- • Could not deduce: Code a ~ '[xs] | ||
-- arising from the superclasses of an instance declaration | ||
-- from the context: (GHC.Generic a, HasDatatypeInfo a, | ||
-- forall (xs :: [*]). Code a ~ '[xs], Monad m) | ||
-- bound by the instance declaration | ||
-- at /run/user/1000/danteazsW1Q.hs:(22,10)-(24,47) | ||
-- • In the instance declaration for ‘Foo m a’ | ||
|
||
|
||
main ∷ IO () | ||
main = do | ||
|
||
putStrLn "You are standing at the end of a road before a small brick building." | ||
putStrLn "Around you is a forest. A small stream flows out of the building and" | ||
putStrLn "down a gully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ mkDerivation, stdenv, base, cabal-install, generics-sop | ||
}: | ||
mkDerivation { | ||
pname = "holotype"; | ||
version = "0.0.1"; | ||
src = ./.; | ||
isLibrary = true; | ||
isExecutable = true; | ||
libraryHaskellDepends = [ | ||
base | ||
cabal-install | ||
generics-sop | ||
]; | ||
description = "Graph-backed visual mind assistant"; | ||
license = stdenv.lib.licenses.agpl3; | ||
doHaddock = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc861", doBenchmark ? false }: | ||
|
||
let | ||
|
||
inherit (nixpkgs) pkgs; | ||
|
||
f = import ./default.nix; | ||
|
||
haskellPackages = if compiler == "default" | ||
then pkgs.haskellPackages | ||
else pkgs.haskell.packages.${compiler}; | ||
|
||
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; | ||
|
||
drv = variant (haskellPackages.callPackage f {}); | ||
|
||
in | ||
|
||
if pkgs.lib.inNixShell then drv.env else drv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters